Form Validation and Integer Fields...

I have a Form with an text entry for an integer value. The integer value in the Bean backing the form is initially NULL.

The field is not required, but if populated must be an integer between 1 and 25.

If the field is not touched or the field contains an integer, the validation works as advertised. That is, all is well if the value is between 1 and 25 and I get the error message if the value is not between 1 and 25.

However! If I enter 1 for the value and then delete the 1, so the field is no longer NULL but is now “”, then I get a NumberFormatException when commit() is called on the form.

This seems like a bug to me. Anyone have a workaround?

Thanks,
Chuck

p.s. I’m on version 6.7.0.

Did you figure it out? Please share if you came up with something good :slight_smile:

One workaround would be to give ValueChangeListener the task of setting the value to null if it’s empty String.

We had to face the same question few weeks ago.

Here our
workaround
for this.