Editable List Validation

  • 29 January 2015
  • 1 reply
  • 3 views

Badge +2
Hi, I have a editable list on my form. It is not mandatory for user to add an item to list. But if user tries to add an item, he/she can not select blank value from drop down. I have this validation at view level in item added and changed event, which works fine. But I also want this validation at form level on a button click, which is not working. Thanks in advance. Aditi

1 reply

Userlevel 1
Badge +8

Hi Aditi

 

I have found validating editable lists to be very problematic. If the data needs to be validated I prefer to use a pop up view to have the user add/edit the data rather than in the list view itself.

 

To do this, create an item view with the fields you want to add (you can bind the view to the smartobject if you want) and add a save button . Add a rule to the save button that validates the view (required fields are input) and then closes the view. Then on your form when the add button is clicked open the subview (remove any rules to add a new row to the list). You will then have the Save rule from the view accessible on the Form (you may need to close and re-open the form to see it).

 

Edit the view Save rule from the Form and do the following just before the close event

 1. Add a new row to the editable list

 2. Transfer data from the subview to the edit row fields (i.e. populate the data from the subview into the list)

 3. Apply the changes to the editable list

 

You can then call the save function as per normal on the list view to save the added row(s).

 

You can also apply the same logic to editing an item - just need to pass in the selected rows data when opening the subview.

Reply