Validating a Sublist Item

Learn how to verify and confirm the accuracy of a specific item within a sublist.

 

You might encounter a scenario where you would need to validate a sublist item. This could be challenging because a sublist item doesn't actually save when you click Save. Instead, it saves when the parent form is saved. So, if there is a sublist item whose validation code should not be evaluated as true, the validation code won't prevent the save until you save the parent form, at which point it's difficult to fix the sublist item that failed. 

Here's a way that you could explore to avoid that issue. After setting up the validation expression and text for your field, you make use of the IsInvalid attribute of the field. You can set an Error Style on that field using the Styling feature, such that it goes red (or whatever colour you want) when the user tabs away from an invalid entry. In the example below, I've set a character length validation on my Title field (in the form's Validation property of the Title field). All I need to put in the Style condition is a reference to the .IsInvalid attribute of the field's placeholder.

 

 

 

Then, to actually prevent a user from saving the invalid data, you can add the opposite condition to the Visible property of the Save button. Note the “!” before [[Title.IsInvalid]]; this negates the condition, causing the Save button to disappear if the user tabs past an invalid entry (i.e. the Save button is only visible when the field is valid).

 

Was this article helpful?

Can’t find what you’re looking for?

Our world-class Customer Success team is here for you.

Contact Support