View Full Version : Empty text for Field objects isn't valid?

24 Nov 2009, 5:45 AM
I have several fields in a form with empty text values used to indicate potentially acceptable values for input. The problem I'm experiencing is that if the user enters the exact empty text values into the fields that they're marked as invalid. Is there any way around this other than adding listeners to every field and setting the empty text to "" on all potentially field value changing events?

24 Nov 2009, 12:40 PM
well you must have had textField.setAllowBlank(false); which sets the invalid flag.

24 Nov 2009, 1:02 PM
Sorry, it doesn't seem that I've clarified my problem properly. I have a field that:

I don't want to allow blank values on, so yes... I have setAllowBlank(false)
I want to specify a value to show up in the field by default that demonstrates the type of input that's exceptable, so I want to use the grayed-out aspect of setBlankValue, without constraining it to being an invalid input.

Here's the workflow that's producing my problem:

TextField with setAllowBlank(false) and setBlankValue("Test")
User clicks into field and types "Test"

Although this is the value that is displayed as the "blank" value, I still want it to be acceptable, yet limit the interface to prevent "" values... perhaps the solution is to have setAllowBlank(true) and provide a custom validator that disallows ""?

24 Nov 2009, 1:53 PM
are you using setEmptyText("Test")??

24 Nov 2009, 2:06 PM
Sorry, yes... in my previous post I meant to say setEmptyText instead of setBlankValue.