Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Table field validation

Fluffy Sandals
1 decade ago Mar 16, 2010 8:39am
Jens Jansson
1 decade ago Mar 16, 2010 11:45am

Hi!

I have recenlty done the same thing with a table. I had to get isModifiied and isValid to work. Unfortunately the table isn't a real component container, and thus isModified and isValid didn't work in the way that I anticipated from them. What you have to do is override those functions and implement them yourself. You have to gather a reference of all the fields that the fieldFactory creates into a collection and run either isValid or isModified against them directly.

This ticket has a wider description about this problem and an example of how it can be done: http://dev.vaadin.com/ticket/3796#comment:3

That worked nice and well with isModified, but even a bigger problem is that the table components has a bug that was a total showstopper for me when I tried to implement isValid. The bug is that a table with a fieldFactory creates the double amount of fields compared to what it needs. Half the fields normally just disappears to oblivion and only the right fields are shown in the table. Problems arises however when you collect references to these fields. You will always get the result that the table is not valid if you for example put setRequired(true) on the fields. Half the fields will always return isValid = false as they are always empty when you can't possibly fill a value to them.

I reported the bug to the Vaadin team at it was fixed within minutes. The fix will however not appear before the version 6.3 so you have to either wait for that or use a nightly build. The ticket about the bug: http://dev.vaadin.com/ticket/4299

Regards,
Jens

Fluffy Sandals
1 decade ago Mar 16, 2010 12:03pm
Mariam Abou-Elfadl
1 decade ago Apr 03, 2010 9:56pm
Joonas Lehtinen
1 decade ago Apr 04, 2010 7:38am