Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.10
-
None
-
Patch
Description
When you put several validators on a field, like a required and a regex validator, you can specify that the second validator should not be run if the first one fails by setting the short-circuit attribute. However, when you set validate='true' on a form, the JavaScript that is generated does not honor the short-circuit attribute. It will always run both validations.
The JavaScript is generated by the Freemarker code in form-close-validate.ftl
I fixed this for my app by adding "var continueValidation = true;" outside the loop, then adding "<#if validator.shortCircuit>continueValidation = false;</#if>" on the line after "errors = true;" in each 'if' block. Then added 'continueValidation && ' to the front of each if.
This seemed to work just fine.
Attachments
Attachments
Issue Links
- is related to
-
WW-3827 Generated Javascript validation short-circuit one field, will short-circuit all the remaining fields.
- Closed