Hi all,
I have two editable grids in my interface and I would like to force the users to enter add at least one row each to the grids. How can I ensure users add a row each to my grid before they click submit?
Secondly, in an editable grid, is it possible for me to limit the maximum number of rows a user can add?
Thanks,
Discussion posts and replies are publicly visible
The easiest way is just to add a validation to the validation parameter in your grid. Suppose you are saving the data of your grid into a local variable called local!rows. The following validation would ensure they must add at least one row:
if( or( isnull(local!rows), length(local!rows)<1 ), "Please add at least one row", null )
You could potentially do the same for the maximum number - just check the length against a maximum value.
I'd also suggest thinking about the best user experience for your users. If they are required to enter at least one row, should you start with a row already added (with maybe a few suggested values)? Or if you want to limit the number of rows, maybe you should hide the "Add Row" link after they have reached a certain number of rows. Validations are usually the easiest but may not be the best experience.
Thanks Peter.