[
https://issues.apache.org/struts/browse/WW-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42714
]
Tom Schneider commented on WW-2255:
-----------------------------------
Another way to handle this is to completely remove the conversions error
interceptor and use the ConversionValidator in the validaiton xml:
<field name="groupProfileData.phoneNumber2">
<field-validator type="conversion" short-circuit="true">
<message key="4.invalid.number.error">Missing default error
message</message>
</field-validator>
<field-validator type="phoneNumber" short-circuit="true">
<message key="18.invalid.phoneNumer.error">Missing default error
message</message>
</field-validator>
</field>
The short-circuit attribute will ensure that only 1 error message is added.
You run into the same issue if you have more than 1 validator defined per field
in the validation xml.
> Field validators should be skipped if there is a conversion error
> -----------------------------------------------------------------
>
> Key: WW-2255
> URL: https://issues.apache.org/struts/browse/WW-2255
> Project: Struts 2
> Issue Type: Improvement
> Components: XML Validators
> Reporter: Adam Crume
> Fix For: 2.1.1
>
> Attachments: ConversionErrorInterceptor2.java
>
>
> If there is an error converting a field, the validators for that field should
> be skipped. For example, let's say I have an action with an "age" field
> declared as an Integer, and the field is required. If the user enters "one",
> the user will see two errors: one from the conversion process, and one from
> the required validator (since the field was never assigned).
> In general, a conversion error should short-circuit all validators for that
> field, since validators depend on the field being set, which never happens if
> there was a conversion error.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.