Hello all,
I've given this one a pretty good effort, having hacked at it a while,
looked at the lists, read the chapters from several of the books, and
still
don't seem to have it quite right.
I set out to write my own custom validator, using the example of
requireIdentical,
to make sure when a new user is added, the confirmation matches the
password
I put the following in my application resources file, to identify my
three fields:
username, password, confirm:
# userForm fields
userForm.username.displayname=User Name
userForm.password.displayname=Password
userForm.confirm.displayname=Confirm
I've got all the validator-specific messages in a separate bundle,
ValidatorResources.properties, and the one of interest to me here is:
errors.identical={0} must be identical to {1}.
I've implemented it in an (add) user form, where I would expect a
message such as:
"Confirm must be identical to Password"
to appear when the confirmation doesn't match the password as a new
user is being added.
Here's my form details in my validation.xml file:
<form name="userForm">
<field property="username" depends="required">
<arg0 key="userForm.username.displayname"/>
</field>
<field property="password" depends="required">
<arg0 key="userForm.password.displayname"/>
</field>
<field property="passwordConfirm" depends="identical">
<arg0 key="userForm.confirm.displayname"/>
<arg1 key="${var:identicalTo}" resource="false"/>
<var>
<var-name>identicalTo</var-name>
<var-value>password</var-value>
</var>
</field>
</form>
So, passwordConfirm depends on the "identical" rule which triggers
properly when the two values are not the same.
My problem/question is: have I set this up right? The reason I ask is
because
instead of displaying the value of userForm.password.displayname
(=Password),
it displays the plain "password" instead.
In other words, it appears to be displaying the
<var-value>password</var-value>
instead of displaying the userForm's password displayname (Password).
Is that what I should expect? It doesn't seem so to me. Have I set
this up wrong,
or is that just "the way it works".
thanks!
-jeff
Oh, and for completeness, my jsp looks as follows with respect to the
example:
<html:password property="passwordConfirm"/>
<html:errors property="passwordConfirm"
bundle="VALIDATOR_BUNDLE"/>
(The rule fires properly, a message comes up, it just isn't the one I
expected :)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

