Commited.
--
Bruno Borges
Summa Technologies Inc.
www.summa-tech.com
(48) 8404-1300
(11) 3055-2060
On 5/9/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> Ok, updating myself in this thread... :D
>
> I think for this integration succeed, one important question must be
> resolved:
>
> Q) What kind of validation this integration will process ?
> a) wicket's internal validation
> b) hibernate validator validation
> c) behavior (like ryan implemented)
>
> I made this code yesterday and it ran ok:
>
> class ValidateForm extends Form {
> public ValidateForm() {
> super("form");
> setModel(new CompoundPropertyModel(new User()));
> add(new TextField("name"));
> add(new TextField("email"));
> add(new HibernateFormValidator(User.class));
> }
> }
>
> class HibernateFormValidator implements IFormValidator {
> private ClassValidator validator;
> public HibernateFormValidator(Class name) { validator = new
> ClassValidator(name); }
> public FormComponent[] getDependentFormComponents() { return
null; }
>
> public void validate(Form form) {
> Object object = form.getModelObject();
> InvalidValue[] invalidValues = validator.getInvalidValues
(object);
>
> for (InvalidValue iv : invalidValues) form.error(iv.getMessage
());
> }
> }
I like this a lot. Can you commit that?
Eelco