PDA

View Full Version : How to set validation on create/update



lp1051
21 May 2012, 6:34 AM
Hi!
I couldn't find anywhere in docs if it's possible to say that validation rule (both for model or Row/CellEditing) should be applied only on creating record or on update. Have I missed something?
Or what would be the way to go? Introduce some flag e.g in the grid and checking in custom validation function if the record is being created or updated?

Thanks for any advice!
Luk

scottmartin
21 May 2012, 6:45 AM
Can you explain this a little more? Are you trying to validate editors in a grid and determine of you are adding or updating the record?

Scott.

lp1051
21 May 2012, 10:45 PM
Hi Scott,

imagine two scenarios.
1) using ordinary form and model validation of "Accept TOS" checkbox - this is typically validated only for creating new records
2) in grid using Row/CellEditing plugin I have one text field which is required when inserting new record (for example: password), but not when editting (admin may or may not wish to change that field).

So far I didn't find any configuration of validation rules for this or similar cases. Do you have any ideas?
Thanks,
Luk