Problem with Validation on Submit Rules
I'm having problems performing form-level validation using the Validation on Submit Rules and am hoping someone has solved this and can offer advice.
I have two fields - a Wage Type and a Wage Amount. I want two rules that say something along the lines of:
If Wage Type = Hourly and Wage Amount > $50, then throw an error message that stops the form being submitted.
If Wage Type = Salary and Wage Amount > $100,000, then throw an error message that stops the form being submitted.
I can see how a simple rule will work, but I can't get these working because of the AND. If I could set the rules to test for the error condition, it would work, but the way Validation on Submit works I have to test for a valid condition and the message is thrown when the condition is false.
I tried using Rules on the Wage Amount fields, and they throw the error messages correctly, but it didn't stop you from acknowledging the message and just hitting Submit, hence my trying the Form-level Rules.
Any help appreciated.
-
Hi David,I was exploring your issue, and I may have found the solution. You need to create a large set 0-100k (or whatever your bounds are), and sub divide like so. You never set a lower bound on Salary/Hourly so I just used 10k and 0.
Edit-Tried to give larger picture. Open in another tab if it's still too small.
-
Thanks for your feedback Scott and Parker. I looked at (and tried) both your suggestions but still no joy.
In the end, I got what I needed by changing the Form Events I was using. I put all my form-level validation in the Before Submit event. There are quite a few rules in there now, all showing a message when they fail a rule. However, because that doesn't cancel the Submit operation, whenever an error is triggered in the Before Submit, I also set a variable (Form Validated) to No. Then in the Validation on Submit Event, I just have one rule - When Form Validated = Yes, Condition Failure Message = Form cannot be submitted - please correct the errors. This then cancels the Submit operation.
So, maybe not as AgilePoint had envisaged it, but it works, and the validation rules are much easier for me to setup.
Please sign in to leave a comment.
Comments
5 comments