On Thu, Feb 17, 2011 at 10:37 PM, Igor Vaynberg <igor.vaynb...@gmail.com> 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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to