wicket - Null-check manually converted TextField value -



wicket - Null-check manually converted TextField value -

i have textfield overrides it's getconverter method add together joda time converter instead:

class="lang-java prettyprint-override">new textfield<p>(id) { @override public <p> iconverter<p> getconverter(class<p> type) { homecoming (iconverter<p>) new jodadatetimeconverter(); } };

the converter returns null if input invalid. however, want able flag field required, , don't know how that:

textfield.isrequired(true) not work, because required checks done before conversion. doesn't work non-empty invalid inputs. textfield.add(.. validator ..) not work because no validator called if converter returned null.

i don't see approach flag date fields required. know how that? approach not suited @ all?

if add together inullacceptingvalidator instead of regular one, called null values too.

subclassing validators homecoming true on validateonnullvalue() might helpfull too.

from javadocs:

indicates whether or not validate value if null. desirable skip validation if value null, unless want create sure value in fact null (a rare utilize case). validators extend , wish ensure value null should override method , homecoming true.

wicket

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -