You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by ronaldlee <yi...@hotmail.com> on 2008/03/05 20:08:09 UTC

T5: override validator error msg on client

Hi,

I am using
"@Validate("required,regexp=^[a-zA-Z0-9_.-]+$,minlength=4,maxlength=20")" to
validate username input, my question is when it fails the regular
expression, the error displayed by "<t:errors/>" is not user-friendly, it
reads something like "Username: does not match pattern '^[a-zA-Z0-9_.-]+$",
but actually it means in english "contains only
letters,numbers,underscore,dot and dash". How can I override that error
message?? I am using 5.0.6.

thx
Ronald
-- 
View this message in context: http://www.nabble.com/T5%3A-override-validator-error-msg-on-client-tp15855647p15855647.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: override validator error msg on client

Posted by ronaldlee <yi...@hotmail.com>.
Thanks for your help, I got it to work now!

I now have another question and not sure if you will know the answer as
well..  I want to write my own Validator, and what it does is to compare the
"password" and the "confirmed password" to see if they are the same. Is
writing your own Validator (so that it can be used with "@Validate") a good
approach? I guess checking whether the password and confirmed password are
identical should be done only on the client side (by javascript) instead of
doing that on server side.. actually I am ok with doing that on server side
as well, but just want to see if I can create a Validator for that so I can
reuse it later on may be for other projects. Thx!

Ronald



Filip S. Adamsen-2 wrote:
> 
> Hi,
> 
>  From the Component Reference entry for TextField:
> 
>    cardnumber-regexp-message=Credit Card numbers consist of 16 digits
>    cardnumber-regexp=\\d{4}(\\-?\\d{4}){3}
> 
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/TextField.html
> 
> -Filip
> 
> ronaldlee skrev:
>> Hi,
>> 
>> I am using
>> "@Validate("required,regexp=^[a-zA-Z0-9_.-]+$,minlength=4,maxlength=20")"
>> to
>> validate username input, my question is when it fails the regular
>> expression, the error displayed by "<t:errors/>" is not user-friendly, it
>> reads something like "Username: does not match pattern
>> '^[a-zA-Z0-9_.-]+$",
>> but actually it means in english "contains only
>> letters,numbers,underscore,dot and dash". How can I override that error
>> message?? I am using 5.0.6.
>> 
>> thx
>> Ronald
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-override-validator-error-msg-on-client-tp15855647p15861887.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: override validator error msg on client

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

 From the Component Reference entry for TextField:

   cardnumber-regexp-message=Credit Card numbers consist of 16 digits
   cardnumber-regexp=\\d{4}(\\-?\\d{4}){3}

http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/TextField.html

-Filip

ronaldlee skrev:
> Hi,
> 
> I am using
> "@Validate("required,regexp=^[a-zA-Z0-9_.-]+$,minlength=4,maxlength=20")" to
> validate username input, my question is when it fails the regular
> expression, the error displayed by "<t:errors/>" is not user-friendly, it
> reads something like "Username: does not match pattern '^[a-zA-Z0-9_.-]+$",
> but actually it means in english "contains only
> letters,numbers,underscore,dot and dash". How can I override that error
> message?? I am using 5.0.6.
> 
> thx
> Ronald

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org