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."
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]