Hmm, it's not working for me.

There's one other thing I spotted. The docs say that a TextField defaults to
String.class even if it cannot work out the class from the model. My model
is not one that allows for reflection to determine the class and initially
all input to the TextField was being set as null even when there was some.
As soon as I added the parameter to set the class to String it started
saving strings correctly.

I will have a look at the code to see if there's anything obvious.

Eric.

On Fri, Mar 28, 2008 at 4:37 PM, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:

> TexField.setConvertEmptyInputStringToNull( true ) worked fine for me
> in a quickstart...
>
> -igor
>
>
> On Fri, Mar 28, 2008 at 8:25 AM, Eric Rotick <[EMAIL PROTECTED]> wrote:
> > 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?
> >  >
> >  >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to