Hm... that won't work b/c t:validate="required, min=prop:total" won't fly
because the "prop" binding prefix would have to be at the beginning of the
string... and specifying the validator as a String property won't work either,
sadly (is there a JIRA for that?).
You're going to need to create the validator in your java class and return it,
something like:
.tml:
<t:textfield t:id="amount" t:validate="prop:amountValidator"/>
.java:
@InjectComponent
private TextField amount;
@Inject
private FieldValidatorSource fieldValidatorSource;
public FieldValidator<?> getAmountValidator() ) {
return fieldValidatorSource.createValidators(amount, "required,min=" +
total);
}
Robert
On Aug 16, 2011, at 8/166:28 PM , Taha Hafeez wrote:
> Not sure but did you try
>
> min=prop:total
>
> On Wed, Aug 17, 2011 at 4:02 AM, leothelion <[email protected]> wrote:
>> Hi all,
>>
>> I am new to T5, and I am trying to compare a server-side variable to the
>> data input from the client side.
>>
>> So is there a way to have something like
>> <t:textfield t:id="amount" t:validate="required, min=${total}"> ?
>>
>> I tried this but it throws an exception as "Could not find a coercion from
>> type java.lang.String to type org.apache.tapestry5.FieldValidator." I am not
>> sure why it takes total as a String while it's a double in the server side.
>>
>> Can anyone help me with this?
>>
>> Thanks!
>>
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/Question-about-FieldValidator-tp4706033p4706033.html
>> Sent from the Tapestry - Dev mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
>
> --
> Regards
>
> Taha Hafeez Siddiqi (tawus)
> http://tawus.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]