[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-dev
Subject:    [jira] [Commented] (WW-3827) Generated Javascript validation short-circuit one field, will short-cir
From:       "Lukasz Lenart (JIRA)" <jira () apache ! org>
Date:       2012-09-26 19:07:08
Message-ID: 1928047223.129965.1348686428577.JavaMail.jiratomcat () arcas
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/WW-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13464067#comment-13464067 \
] 

Lukasz Lenart commented on WW-3827:
-----------------------------------

As I understand that's how it should work. Short-circuit should stop any other \
validations for all remaining fields

http://struts.apache.org/2.x/docs/validation.html#Validation-ShortCircuitingValidator \
  
> Generated Javascript validation short-circuit one field, will short-circuit all the \
>                 remaining fields.
> -----------------------------------------------------------------------------------------------------
>  
> Key: WW-3827
> URL: https://issues.apache.org/jira/browse/WW-3827
> Project: Struts 2
> Issue Type: Bug
> Components: XML Validators
> Affects Versions: 2.2.1, 2.3.3
> Reporter: Jerome Chin
> Fix For: 2.3.5
> 
> Attachments: form-close-validate.ftl
> 
> 
> 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. \
> {code:xml} <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>
> {code}
> 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 ...
> {code:xml}
> <#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>
> {code}
> ... snip ...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic