an int (primitive) is always required. We have to set it to something. cant be null if you want to be able to not require it (so null) make it an Integer not int
On Wed, Jan 27, 2010 at 16:48, Thierry Leveque <[email protected]> wrote: > Here's what I have in my code: > > TextField<Integer> lAdaptingHitCountThreshold = new TextField<Integer>( > "AdaptingHitCountThreshold", new PropertyModel<Integer>( lMcsConfig, > "Adapting.HitCountThreshold" ) ); > > lForm.add( lAdaptingHitCountThreshold.setRequired( false ) ); > > But when I execute it, if I do not enter any value in the field, I keep > getting the message "Field 'AdaptingHitCountThreshold' is required." > Why? In my pojo data object (lMcsConfig), the field is really of type > "int", > but it is not required. > > Is there a simple way to make this work? Other than creating my own model? > > Thierry >
