You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vishy_sb <sh...@gmail.com> on 2008/11/19 22:57:22 UTC

Validation Question

Hi all,

I am trying to get some validations to work using the FeedbackPanel. My form
has a Textfield and I am trying to use a NumberValidator to check if it is
in a given range. The code that I have used is :

TextField pgLongLimit = new TextField("pgLongLimit", new PropertyModel(
						pglimit, "longLimit"));
				pgLongLimit.setRequired(false);
				pgLongLimit.setLabel(new Model("Long Limit"));
				validator.addNumberRange(pgLongLimit, 0, Integer.MAX_VALUE);

My classname.properties file looks has following code:
NumberValidator.range = ${label} should have a  positive integer value


Now whenever I put in a negative input I get the correct error i.e "Long
Limit should have a  positive integer value".

However if I put in a char value as an input (say 'a') then the error is "a
is not a valid int". I want to change this error to something like "Invalid
input". 

Any ideas about how I can do that. I don't know which resource key I would
have to use here.

Thanks,
vishy
-- 
View this message in context: http://www.nabble.com/Validation-Question-tp20590141p20590141.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Validation Question

Posted by vishy_sb <sh...@gmail.com>.
Works like a charm.... 

Thanks a lot

Cheers,
vishy

jWeekend wrote:
> 
> Vishy,
> 
> Add
> 
> IConverter=Invalid Input
> 
> to a properties file in, for example,  MyApplication.properties for your
> whole application or in MyPage.properties if you want this custom message
> on a particular page only ... etc, in the same package as the class with
> the same name.
> 
> Regards - Cemal
>  http://www.jWeekend.co.uk http://jWeekend.co.uk 
> 
> 
> vishy_sb wrote:
>> 
>> Hi all,
>> 
>> I am trying to get some validations to work using the FeedbackPanel. My
>> form has a Textfield and I am trying to use a NumberValidator to check if
>> it is in a given range. The code that I have used is :
>> 
>> TextField pgLongLimit = new TextField("pgLongLimit", new PropertyModel(
>> 						pglimit, "longLimit"));
>> 				pgLongLimit.setRequired(false);
>> 				pgLongLimit.setLabel(new Model("Long Limit"));
>> 				validator.addNumberRange(pgLongLimit, 0, Integer.MAX_VALUE);
>> 
>> My classname.properties file looks has following code:
>> NumberValidator.range = ${label} should have a  positive integer value
>> 
>> 
>> Now whenever I put in a negative input I get the correct error i.e "Long
>> Limit should have a  positive integer value".
>> 
>> However if I put in a char value as an input (say 'a') then the error is
>> "a is not a valid int". I want to change this error to something like
>> "Invalid input". 
>> 
>> Any ideas about how I can do that. I don't know which resource key I
>> would have to use here.
>> 
>> Thanks,
>> vishy
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Validation-Question-tp20590141p20603101.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Validation Question

Posted by jWeekend <jw...@cabouge.com>.
Vishy,

Add

IConverter=Invalid Input

to a properties file in, for example,  MyApplication.properties for your
whole application or in MyPage.properties if you want this custom message on
a particular page only ... etc, in the same package as the class with the
same name.

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 


vishy_sb wrote:
> 
> Hi all,
> 
> I am trying to get some validations to work using the FeedbackPanel. My
> form has a Textfield and I am trying to use a NumberValidator to check if
> it is in a given range. The code that I have used is :
> 
> TextField pgLongLimit = new TextField("pgLongLimit", new PropertyModel(
> 						pglimit, "longLimit"));
> 				pgLongLimit.setRequired(false);
> 				pgLongLimit.setLabel(new Model("Long Limit"));
> 				validator.addNumberRange(pgLongLimit, 0, Integer.MAX_VALUE);
> 
> My classname.properties file looks has following code:
> NumberValidator.range = ${label} should have a  positive integer value
> 
> 
> Now whenever I put in a negative input I get the correct error i.e "Long
> Limit should have a  positive integer value".
> 
> However if I put in a char value as an input (say 'a') then the error is
> "a is not a valid int". I want to change this error to something like
> "Invalid input". 
> 
> Any ideas about how I can do that. I don't know which resource key I would
> have to use here.
> 
> Thanks,
> vishy
> 

-- 
View this message in context: http://www.nabble.com/Validation-Question-tp20590141p20593050.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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