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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 month ago
TextField null representation and setting value programmatically
Hi all,
Using Vaadin v7.5.9, I have a textfield declared as follows:
TextField tf = new TextField();
tf.setNullRepresentation("");
tf.setNullSettingAllowed(true);
tf.setImmediate(true);
tf.addValueChangeListener( .. )
Now, if I programmatically set its value to the empty string...
tf.setValue("");
... and then retrieve its value in the ValueChangeListener...
String value = tf.getValue();
... the resulting value should be null, right? Or have i missed something?
Anyways, value turns out to be the empty string.
Is this a bug?
Last updated on
No - from javadoc of setNullRepresentation:
Textual representation for null strings.
Nothing about converting a null representaion to null value.
Javadoc of setNullSettingAllowed:
Sets the null conversion mode.
If this property is true, writing null-representation string to text field always sets the field value to real null.
Sou you need to call:
setNullSettingAllowed(true);
to get null for empty string.
Last updated on
You cannot reply to this thread.