Posted: 13 Jan 2017 13:40 EST Last activity: 8 Feb 2017 1:07 EST
UI field validations - Rule Choice
Scenario: You have a section, typically a form, containing 25 fields. This 25 fields are spread across 3 different layouts. The values entered into these fields have to be validated on tab out rather than on submit. However the system should not allow the form to be submitted with errors as well. What are the possible options? Which is the best way to achieve this? Why and why not for each choice of rule. Probable rules of choice: 1) Edit validate on the property 2) Declare constraints 3) Declare On Change Please add if I had missed any other way in which this can be implemented. Provide your reason for choosing one type of rule, and why not the other. Thanks in advance.
***Updated by moderator: Lochan to move post from Applications to PSC***
Thanks for the prompt response. Edit validate would be the favorite rule choice. But i am giving you a scenario where certain business specific properties such as validating an email ID property can become project specific when we look for a certain domain (i.e firstname.lastname@example.org). Now the same property might have varying validations for various region specific apps / modules of the project. In this case, having a common validation on property might not work out. Same goes for properties that are on the framework level, since there is a chance that these properties might have validations specific the the class hierarchy.
Also on change --> refresh section --> activity call --> validation rule --> property-set-message design tends to fail as the refresh on the 2nd field takes away the error message set on the first field unlike error message set by the edit validate after post value behaviour (reload cell).
Won't it be cool to have an edit validate rule of choice specific to the section in which the property is referred rather than the having it on the property itself? And this gets called on every post value thereby not refreshing the entire section. More like On change --> reload cell --> call edit validate.
Why not add a UI Action Set to the cell itself, selecting "onchange >> run script"? You could have a different script for every cell in the form, with no connection to the actual property being displayed in the cell. So the script that runs could do any sort of validation you desire.