commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daggumalli, Sivaji" <SDAGG...@amfam.com>
Subject [Validator] how to give user input in Arg
Date Wed, 16 Nov 2005 22:04:24 GMT
Hi, 

 

Afternoon got a commons Validator problem...

We are using the Struts Validator and in my validation.xml i have:

<form name="myForm"> 

<field property="dateOfBirth" depends="required, date">
<arg0 key="x.dateOfBirth"/> 

<var>
<var-name>datePatternStrict</var-name>
<var-value>dd/mm/yyyy</var-value>
</var>
</field>
</form>

In Application Resources i have:

errors.date={0} is not a date.
x.dateOfBirth=Date Of Birth

If the user entered date is in the wrong format an error message is
produced:

Date Of Birth is not a date. This is all good. But what I am trying to
achieve is including the input value in the message. I know in the
validation.xml you can specify and use vars in the error message (for
example):

<arg1 key="${var:minlength}"
name="minlength" resource="false" />
<var>
<var-name>minlength</var-name>
<var-value>10</var-value>
</var>

What I want to do is replace the <var-value> (the literal vaue '10')
with the user input. I have tried many things

${field:dateOfBirth}, ${dateOfBirth}, ${myForm.dateOfBirth} but none
have worked.

 

 

Regards and Thanks in advance,

Siva

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message