Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
2.2.1, 2.3.3
-
None
Description
When you set up your validation.xml with short-circuit and use client-side validation by setting validate="true" in the s:form tag.
if one of the field has a short-circuited field-validator, the remaining generated javascript validations will be short-circuited as well.
For example, the following validation xml, if password has error, phone number will not be validate at all in the client-side.
<field name="password"> <field-validator type="requiredstring" short-circuit="true"> <param name="trim">true</param> <message key="ERROR.REQUIRED_LOGIN_PASSWORD"/> </field-validator> <field-validator type="fieldexpression" short-circuit="true"> <param name="expression">password==confirmPassword</param> <message key="ERROR.CONFIRM_PASSWORD"/> </field-validator> <field-validator type="stringlength"> <param name="trim">true</param> <param name="minLength">6</param> <message key="ERROR.PASSWORD_TOO_SHORT"/> </field-validator> </field> <field name="phoneNumber"> <field-validator type="requiredstring" short-circuit="true"> <param name="trim">true</param> <message key="ERROR.REQUIRED_PHONE_NUMBER"/> </field-validator> <field-validator type="regex"> <param name="trim">true</param> <param name="expression"><![CDATA[^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$]]></param> <message key="ERROR.INVALID_PHONE_NUMBER"/> </field-validator> </field>
This seems to be caused but the continueValidation flag in the form-close-validate.ftl freemarker template.
I've added a line in the template to reset the continueValidation flag at the start of each field:
... snip ...
<#list parameters.tagNames as tagName> <#-- Fix issue with short-circuit one field-validator will short-circuit field-validators of other field name as well --> // field validators for tag, ${tagName} continueValidation = true; // reset flag, as we are starting a new field name. <#list tag.getValidators("${tagName}") as validator>
... snip ...
Attachments
Issue Links
- relates to
-
WW-2270 Generated JavaScript for validators does not honor the short-circuit attribute
- Closed