Hi,

Please see inline.

On Thu, Feb 11, 2016 at 4:12 PM, Lorne Malvo <[email protected]>
wrote:

> Say I have a TextField like so:
>
> TextField<Integer> amountField = new TextField<Integer>("someTextField",
> someModel);
> amountField.setType(Integer.class);
>
> Where can I customize the error message when the user enters a value other
> than an integer?
>

In this case you can do it in:
- com.example.MyPanel.properties
- com.example.wicket-package.properties
- same for the parents of component/package
- MyApplication.properties


>
> I generate the id for this text field on the fly, so I can't specify it in
> the page class' .properties file (or can I? can I use wildcards in a
> properties file?)
>

You can use wildcards (or rather placeholders) in the values, but not in
the resource keys.


> But it would be good enough in this particular case to simply change the
> error message application-wide.
> Howeveer, I can't find where the default message is generated.
> Documentation refers to an application.properties file which I don't see to
> have.
>

I think you are looking for
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/Application.properties#L16


>
> (another way of doing this i thought of was to clear all error messages,
> and
> then setting a new error message using the errror() method. however, the
> clearing of error messages via FeedbackMessages.clear() does not seem to
> work)
>
> How do find the default message and edit it?
>

Create MyApplication.properties[.xml] next to MyApplication.java, make sure
it is copied to target/classes/, i.e. it is next to MyApplication.class in
the produced .jar/.war,
add  "IConverter=Your version of 'The value of '${label}' is not a valid
${type}'."


>
> Thanks!
>

Have fun!


>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/How-to-refer-to-a-validator-message-for-a-textfield-with-a-certain-type-tp4673555.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to