stevecross
stevecross

Reputation: 5684

How to turn off converting empty strings to null in Wicket?

I have a form with some textfields. It is valid to enter nothing into the fields, but I want to get the empty String then. Wicket automatically converts empty strings to null. I found out that FormComponents have a flag called FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL. I think this flag is responsible for my issue.

But how can I override this flag? Are there global Wicket-settings for this?

Upvotes: 2

Views: 564

Answers (1)

Nicktar
Nicktar

Reputation: 5575

If you found this flag you might have noticed this method

public final FormComponent<T> setConvertEmptyInputStringToNull(boolean flag)

that's used to set the flag to whatever boolean value desired... It's part of the AbstractTextComponent parent-class to TextField. For further information, check the JavaDocs

Upvotes: 6

Related Questions