I guess we could do that somehow.
But then we need to specify that somehow in youre IModel interface.

so instead of getObject(Component) we also should have getType(Component)
That will effect a lot of things.

johan


On 3/15/06, Andre Matheus <[EMAIL PROTECTED]> wrote:
Why can't wicket discover the type using reflection?
___
Andre Matheus


On 3/14/06, Igor Vaynberg < [EMAIL PROTECTED] > wrote:
also look at FormComponent.setType(Class). wicket can perform type conversion from the request parameter string to the type of your model object. if the conversion fails it generates a validation error.

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 -----
Sent: Tuesday, March 14, 2006 3:52 PM
Subject: [Wicket-user] validating input

I 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





--
__
André Matheus

Reply via email to