Generated JavaScript for validators does not honor the short-circuit attribute
------------------------------------------------------------------------------
Key: WW-2270
URL: https://issues.apache.org/struts/browse/WW-2270
Project: Struts 2
Issue Type: Improvement
Components: Validation
Affects Versions: 2.0.10
Reporter: Aaron Freeman
Attachments: form-close-validate.ftl
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.