so TextField tf=new TextField("id", model);
tf.setType(Integer.class)
will only accept values that can be converted to integers
for explanation on how errors are constructed try searching the wiki for "validation messages"
-Igor
On 3/14/06, Jonathan Cone <[EMAIL PROTECTED]> wrote:
Hey Vincent,In wicket, validators can be add()ed to components like anything else. For example, one way to make a textfield required without using the helper class would be to do something like:TextField tf = new TextField("id",...);tf.add(RequiredValidator.getInstance());Check out the javadoc for the wicket.markup.html.form.validation package, there are some common validators in there and its real easy to write a custom one yourself. I think you'll find that validation in wicket is as easy as you were hoping.----- Original Message -----From: Vincent JenksSent: Tuesday, March 14, 2006 3:52 PMSubject: [Wicket-user] validating inputI just built a form that has a mixture of TextField, TextArea, and CheckBox components in it. I am now adding validation to get a feel for how it works but am confused.
I found that I could substitute a TextField with a RequiredTextField and validation was *extremely* simple to setup....if you're using <input> form fields. However, it doesn't appear that these helper classes exist for all types of form widgets...or am I mistaken?
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.2/280 - Release Date: 3/13/2006
