Data Table Validators

Hi,
I’ve added a custom validator that ensures at least on entry to a data table. This works, however I have 3 columns in the table and once the user fills in the first column, they can tab out of the table and submit without completing the remaining two columns. I’ve tried adding column validation but this does not work. Is there a way to enable entries in all columns on the add new record action.
Cheers

Dear @flowy,

I’m not sure I understand your issue clearly, I’m sorry. Could you please provide the screenshot?

So in my form I have a data table with 3 required columns.


I've successfully added a validator to ensure at least one entry is added to this table.

However, once a user populates the column they can tab out and not compete the remaining 2 columns and submit the form. I've tried adding a column validator but his does not work and ruins my previous validator.

"fd.control('DataTable').addColumnValidator('Level', {
error: 'Error message',
validate: function(value) {
if (value <= 0) {
this.error = 'You must select a Programme Level';
return false;
}
return true;
}
});

Is there a way to make the columns active so the user, even if they tab out, must input an entry.
Thanks

Dear @flowy,

Thank you for your request, we are researching your issue.

Dear @flowy,

The bug was added to our bug tracking system, I’ll keep you up to date.

Thanks for your help!

Is there any update on this? Was it fixed?

I can confirm that this is happening to me.

It seems that the "true" value returned by the row validator, is accepted and the testing stops. Seems like what is missing is:

if (condition)
    return false
else if (condition)
    return false
else if (condition)
    return false
else
    return true

@smithme,

You can make the DataTable column required in the designer:
image

Thus, a user can't save the new line if the column is blank.
image

1 Like

@mnikitina I think there's a bug that is being worked on that functionality, per Nikita's reponse here: Concept for dataTable validator. @smithme, @Nikita_Kurguzov provided some validator logic for me that is currently working great.

Gabe

1 Like

I have all the columns set to required and the form still allowed the save with empty values.

This did work but then I noticed something interesting.

After completing a fully completed form (all values where entered) and saving the form, then I edited the form and deleted the row and tried to save, the form saved with NO rows.

I am also getting a presentation problem that would be nice if it was fixed. The error message is inside of the scrolling div of the table so when it appears it is partially hidden. If you scroll the div you can see the message.

@Gabegia,

Yes, you are right! I'm sorry, I've missed that the validation doesn't work on the form submit, not when the row is saved.

@smithme,

I couldn't reproduce that on my form. Could you please provide more details about the issue. If that possible, the short video would be very helpful.

I'll pass the information about the error message and the scroll bar to our developers. Thank you for noticing this.

@smithme I double checked that I wasn't losing data as well - that's not happening on mine when I edit.

I had to pull the column validation out of the form to get it to work. This is a production form and it was important that I get it working again. This means I can no longer provide examples of the problems I'm having.