If yo have a Required validator on a TextField with wicket:id="mytextfield"
in a form with wicket:id="myform" in a Page called MyPage.java in a package
called com.mypackage then 

create a file called MyPage.properties in the package com.mypackage

in this properties file is where you override the validation messages for
anything in the page, so in this example you would add the line

myform.mytextfield.Required=My required message

see how the hierarchies match and the Required is the same name as your
validator class (so if you used an EmailAddressValidator you would put
myform.mytextfield.EmailAddressValidator)

If your form was in its own java file called MyForm.java then you would put
the properties file in the same package as MyForm.java and you would call
your properties file MyForm.properties

and it would look like this

mytextfield.Required=My required message

note how you dont need the myform. bit.

Also see this page:
http://cwiki.apache.org/WICKET/form-validation-messages.html

Hope that explains it

Richard


wenm wrote:
> 
> I try to validate component by using setRequired(). and I would like to
> define the feedback messages in application level properties file. 
> 
> For example, the application structure is like
> myApplication
>  -basePage
>  -myPage extends basePage
>  -myForm
>  -myTextField
> 
> I tried to overwrite the default message in myApplication.properties like:
>   myPage.myForm.myTextField.Required = something is missing
> But it is not succeful. 
> 
> I don't know whether I do something wrong or I have to set up something in
> myApplication?
> Thanks.
> 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to