Moving from Vaadin 6 Forms to Vaadin 7 FieldGroup

Hi,

I’m having a few issues transitioning from Vaadin 6 Forms to Vaadin 7 FieldGroup. I’ve got a few ideas in mind and would like to know if these are the right approaches. I’m using Vaadin 7.0.0.rc1, Runo for my theme, and CustomLayout with BeanFieldGroup to create Validators from my bean annotations.


Field validation icons (!) show up when the form is initially rendered with empty fields.

Previously the icons only showed when a field lost focus or the form was submitted. To recreate this I plan to iterate over the fields and set setValidationVisible to false. Then add focus listeners on each field to commit on blur. If an error happens then setValidationVisible to true. Same goes for the Submit button.


@NotNull required fields do not display the * icon

Not sure on where to go with this one


Nested properties are not validated.

Here I plan to create several BeanFieldGroups, one for the original bean and one for each nested bean.


Fields are not spaced apart from each other.

Looks like setSpacing is gone. I’ll add some CSS for this.


Validation error messages are not displayed in the form.

When I catch commit errors I’ll update a label I insert in CustomLayout.

Thanks for any help,

Joe

Here’s an update in case others are stuck on this too…


Field validation icons (!) show up when the form is initially rendered with empty fields.

I’m holding off on a workaround and have submitted a ticket: http://dev.vaadin.com/ticket/11017


@NotNull required fields do not display the * icon

Same as above: http://dev.vaadin.com/ticket/11014


Nested properties are not validated.

Adding a fieldgroup per bean worked for this, not as clean as using nested properties but the annotations work.


Fields are not spaced apart from each other.

This was my mistake, the original forms spacing was set with CSS and I just needed to adjust it.


Validation error messages are not displayed in the form.

For this I listen for blur events on all my fields, validate the entire form from top to bottom, then use the exception message in an error label.

Hi all,

I am having all these same issues, it´s qiute funny how V7 could implement BeanValidation so incompletly.

Will I have to wait V7.1 to replace Forms for FieldGroup?

Regards,

Similar questions here, specifically the issue that there seems to be no easy way to show the validation messages.

The same problems in my expirence with Vaadin 7 Forms.

Still no solution for validation messages? It is really annoying, what would be the use case of showing error messages when form is initially rendered?

Fuck off Vaadin 7.0.1, moving back to Vaadin 6.8.9

Until this new release is reliable I’ll wait longer before using it.

Cheerss

Any updates about this issues?

I´m currently interested on this one:

Nested properties are not validated.
Adding a fieldgroup per bean worked for this, not as clean as using nested properties but the annotations work.

Thanks!

Im trying this:


	binder = new BeanFieldGroup<ContaEmpresa>(ContaEmpresa.class);
    	binder.setFieldFactory(new CustomFieldFactory());
    	ContaEmpresa bean = controller.getCurrentBean();
    	binder.setItemDataSource(bean);
        
        TextField nomeTextField = (TextField) binder.buildAndBind("Seu nome", "nome");        
        TextField empresaTextField = (TextField) binder.buildAndBind("Nome da sua Empresa", "empresa.nomeFantasia");

The first text field (the validation errors are fired on a binder.commit() call)

But the second one, with a nested property, the validation errors are not fired. The problem is that the nested entity cant be saved, because we have validation errors, that are not handled by UI because i cant find a way to solve this with BeanFieldGroup. Not even adding a new BeanValidator to the textField

Thanks!


Validation error messages are not displayed in the form.

For this I listen for blur events on all my fields, validate the entire form from top to bottom, then use the exception message in an error label.
[/quote]

After create a FieldGroup, do ‘buildAndBind()’ for all the FieldGroup fields; and add ‘BeanValidator’ for all of ones;
I’d created a ‘MyPersonalBlurListener implements BlurListener’ class.
I’m able to commit and validate/get error in the field;
But I’m unable to call validate() method in my fieldGruop, the commit method should be done it.
So I not understood how to catch exception message for every single validate field.

cheers

Using :
try{
form.commit();
} catch (CommitException e) {
Notification.show(“ERROR” + e.getCause().getLocalizedMessage().toString());
error.setValue("Error : " + e.getCause().getLocalizedMessage().toString());
}

I get only The first Validation Error…
any suggestions?

Solved;
Get only the first Field exception message in an error label allow to set much more annotation for a single Field;
Much more userFriendly.

I’ posted the code catch from
http://morevaadin.com/content/bean-validation-and-vaadin-comprehensive-example/
for future use of this FEATURE.

Using:
.v-textfield-error { background-color: pink !important; }

Facilitate a lot

13131.java (3.41 KB)

Hello,
I am trying vaadin 7.3.5 and I see that these problems are not solved.
What can I do? I am returning to old form, even if it is deprecated.

Thanks for any help,
Mario

I still have deprecated Forms, and what I see is that the discard() method doesn’t work any more – info is being written to the bean item immediately. I haven’t found a way to stop that (and am now trying to figure out field groups and what happened to the factory methods that passed a prop id).

Are you also seeing an immediate write-through issue with Form or is it working for you?

Bobby