Re: How to refer to a validator message for a textfield with a certain type
Thanks Martin! So is a validator for, say a textfield with a certain type always referred to as "IConverter" in properties files? So, if I used the properties file next to my example class, say com.MyExample.properties, would my path look like: someComponent.someComponent.myTextField.IConverter=My Error Message ? Or how would I would refer to the specific validator that validates integer input? Thanks again! -- 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-tp4673555p4673565.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to refer to a validator message for a textfield with a certain type
Hi, On Fri, Feb 12, 2016 at 9:49 AM, Lorne Malvowrote: > Thanks Martin! > > So is a validator for, say a textfield with a certain type always referred > to as "IConverter" in properties files? > > So, if I used the properties file next to my example class, say > com.MyExample.properties, would my path look like: > > someComponent.someComponent.myTextField.IConverter=My Error Message > Yes! Or just "myTextField.IConverter=My Error Message". The more specific path wins. > > ? > > Or how would I would refer to the specific validator that validates integer > input? > > Thanks again! > > -- > 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-tp4673555p4673565.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: How to refer to a validator message for a textfield with a certain type
Thank you! -- 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-tp4673555p4673578.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to refer to a validator message for a textfield with a certain type
Hi, Please see inline. On Thu, Feb 11, 2016 at 4:12 PM, Lorne Malvowrote: > Say I have a TextField like so: > > TextField amountField = new TextField("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: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >