It can be called with null value when you set DropDownChoice.setNullValid(true).
You don't want to understand that this is a good behavior in many
cases, not a bug. But ok it is your framework, so you decide. But
maybe other Wicket commiters have a different feeling about it?

--
Daniel

On Fri, Feb 18, 2011 at 5:36 PM, Igor Vaynberg <[email protected]> wrote:
> that looks like a bug to me. the reason it has gone unnoticed for so
> long is that someone would have to hack html to cause it. onchange
> only fires in browsers when there is a value selected, so that code
> would not typically be called with a null, and thus no need to check
> required.
>
> -igor
>
> On Fri, Feb 18, 2011 at 7:22 AM, Daniel Stoch <[email protected]> wrote:
>> On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg <[email protected]> 
>> wrote:
>>> validation is there to make sure the user of the webapp cannot push an
>>> illegal value into a model. it doesnt matter if its just the component
>>> that is being submitted or the entire form. components decide whether
>>> or not a user can push null in by using their required flag. you want
>>> to push null, dont mark the component as required. it is as simple as
>>> that. you can create your own updating behavior that calls
>>> setrequired(false) on the component prior to running validation/model
>>> update if that is what you want. but we will not ship something like
>>> this as part of core because it doesnt generally make sense.
>>>
>>> -igor
>>
>> I've found examples in Wicket core, which are very similar to my
>> use-cases, so it looks like sometimes it does make sense :).
>>
>> Look at the classes which implements IOnChangeListener. There is a
>> method onSelectionChanged() which implementation in many cases looks
>> like:
>>
>>        public final void onSelectionChanged()
>>        {
>>                convertInput();
>>                updateModel();
>>                onSelectionChanged(getModelObject());
>>        }
>>
>> So as you can see here validation is bypassed and null values can be
>> push into the model even if FormComponent is required. Eg.
>> DropDownChoice: when I use non-ajax
>> wantOnSelectionChangedNotifications() I can push null into its model,
>> but the same thing does not work with OnChangeAjaxBehavior(). So there
>> is a small inconsistence between ajax and non-ajax functionality. My
>> case is to allow the same behavior for ajax calls.
>>
>> --
>> Daniel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to