I've just been reading the section on Forms and validation in Wicket in
Action and have tried

    AbstractValidator av = new AbstractValidator( ) {
        protected void onValidate( IValidatable validatable ) {
            // No nothing
        }
        public boolean validateOnNullValue( ) {
            return true;
        }
    };

adding one of these to the TextField but still an empty string gets
returned.

All I want to do is get a null string rather than an empty string from a
TextField. Has nobody had this use case?


On Thu, Mar 27, 2008 at 5:02 PM, Eric Rotick <[EMAIL PROTECTED]> wrote:

> I've just realised that the database is getting filled with columns of
> empty strings which then don't cause the 'not null' test to trip.
>
> The culprit is the TextField returning an empty string rather than a null.
> I can see there are some special considerations for returning a null and I
> want to understand how they will effect me. However, I've tried
>
> TexField.setConvertEmptyInputStringToNull( true )
>
> with no effect and using
>
> new TextField( id ) {
> public boolean isInputNullable() {
> regturn true;
> }
> };
>
> also with no effect.
>
> I'm assuming I'm not the first person to see this effect and I guess it's
> lack of understanding rather than some implicit behaviour but I can't find
> anything guiding on the subject.
>
> In this case, the string has no special formatting, it just needs to be
> stored verbatim in the database but the application logic in the backend
> uses an empty string in a different way than a null string and, yes, maybe
> the database should also have a column check but it doesn't at present.
>
> Any pointers?
>
>

Reply via email to