You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve Stair <st...@rrc.state.tx.us> on 2003/03/04 22:37:53 UTC
FYI: Bug fix iin RC1 changed validator behavior
In 1.1-b2, the "depends" field of the validator definition was being
ignored
<validator name="mask"
classname="org.apache.struts.util.StrutsValidator"
method="validateMask"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
depends="required"
msg="errors.invalid">
Even tho when validating to a particular pattern, the mask definition
stated that
it presupposed that the required validation had passed, in actuality,
no such
validation was being done.
This meant that you could set up a validation as follows:
<field property="phone" depends="mask">
<msg name="mask" key="phone.maskmsg"/>
<arg0 key="prompt.phone"/>
<var>
<var-name>mask</var-name>
<var-value>^\(?[0-9]{3}(-| |\))?[0-9]{3}(-|
)?[0-9]{4}$</var-value>
</var>
</field>
Which would not require the user to specify a phone number, but if they
did,
the phone number would have to match the pattern given.
In 1.1-rc1, with the same validation set-up, the phone number is
required to
be entered, I assume because the code is doing the validations listed
in the
"depends" field of the validation definition.
I know most ppl have just forced this behavior by adding "required"
before "mask"
in their validation configurations, but for those few who might have
written code
assuming this behavior, I think a note should be added to the release
notes :)
--
Steve Stair
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org