<arg0 key="label.bin.title"/>
but this will work:
<arg0 key="label.bin.title" resource="true"/>
I will enter this as a bug, because the documentation states that "By default the arg0-arg3 elements will try to look up the key attribute in the message resources" at
http://jakarta.apache.org/struts/userGuide/dev_validator.html
Thanks for your help Mike & David,
Matt
Mike Kienenberger wrote:
Sgarlata Matt <[EMAIL PROTECTED]> wrote:
I'm having some trouble using the maxlength validation and I was hoping someone could give me some help. I have a form with one required field and one field with a maximum length of 2000 characters. When input validation fails for both fields I get the following messages (text in parentheses I added):
Bin Name is required. (good!) null can not be greater than 2000 characters. (not good)
<field property="description" depends="maxlength"> <arg0 name="fieldname" key="label.bin.title"/> <arg1 name="maxlength" key="${var:maxlength}" resource="false"/> <var> <var-name>maxlength</var-name> <var-value>2000</var-value> </var> </field>
That looks like it should work to me. I started with maxlength and created my own "length" function. The only difference I see is that I use "key, name, resource" and you're using "name, key, resource." [And yes, my mask validator is probably redundant.]
<field property="socialSecurityNumberA" depends="required,length,positiveNumber,mask"> <msg name="length" key="errors.lengthDigits"/> <arg0 key="label.socialSecurityNumberA" resource="true"/> <arg1 key="${var:length}" name="length" resource="false"/> <var> <var-name>length</var-name> <var-value>3</var-value> </var> <var> <var-name>mask</var-name> <var-value>^[0-9][0-9][0-9]$</var-value> </var> </field>
David Graham <[EMAIL PROTECTED]> wrote:
Try: <arg0 name="maxlength" key="${var:maxlength}" resource="false"/>
The number after "arg" is the position in the message to replace so you need a 0.
Since his output was "null can not be greater than 2000 characters.", that would simply create "2000 can not be greater than 2000 characters."
-- Matthew Sgarlata Senior Consultant Booz Allen Hamilton Inc. Work: 703-377-0871 Fax: 703-902-3608
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]