You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nivedan Nadaraj <sh...@gmail.com> on 2010/07/22 09:35:59 UTC

Re: AjaxButton OnSubmit Validation Overridden

Hi All,

I did look up the Nabble archive for key-words like 'AjaxButton onSubmit',
AjaxButton and OnError. I did not get anything that addressed this.So do
bear with me with this is re-post.

I have a field(few fields) for which is setRequired(true).

Below this field(s) I have an WebMarkupContainer that contains a
ListMultipleChoice control with Add and Add buttons. These buttons are of
type AjaxButton.

When I select some items form the ListMultipleChoice control and hit Add or
Add ALL, it triggers the form validation for the 'required fields' and in
this case I have not 'yet' populated them. So instead of onSubmit, it goes
to onError.

How can I get around this? Best practices?

Thanks for the time
Regards
Niv

Re: AjaxButton OnSubmit Validation Overridden

Posted by Nivedan Nadaraj <sh...@gmail.com>.
Hi
Thanks for that, I guess building the piece of code as a separate
component(panle) helps. This should deal with Multi Select with add/remove
buttons with submit (Default behavior) .
Having the multi-select logic more generic would help in re-use.I think.

Cheers

On Thu, Jul 22, 2010 at 4:58 PM, vov <vo...@mail.ru> wrote:

>
> Hi,
>
> Read
> http://www.wicketframework.org/apidocs/wicket/markup/html/form/Form.html
> about nested forms.
> Also your can put your ListMultipleChoice and buttons to separate Panel
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Re-AjaxButton-OnSubmit-Validation-Overridden-tp2298251p2298343.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AjaxButton OnSubmit Validation Overridden

Posted by vov <vo...@mail.ru>.
Hi,

Read
http://www.wicketframework.org/apidocs/wicket/markup/html/form/Form.html
about nested forms.
Also your can put your ListMultipleChoice and buttons to separate Panel
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-AjaxButton-OnSubmit-Validation-Overridden-tp2298251p2298343.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxButton OnSubmit Validation Overridden

Posted by Nivedan Nadaraj <sh...@gmail.com>.
Although..the Model is not updated on the ListMultipleChoice control. So
when I use the Remove Selected button I get the values from
listControl.getModelObject() this returns a null list.So a NP exception is
thrown.

I turned the defaultFormProcessing back on to the standard one for this'
particular button'. When I provide the required fields with data then it
works as in no NP exception and the model does return the values selected.

Any pointers? Cheers
Niv

On Thu, Jul 22, 2010 at 4:19 PM, Nivedan Nadaraj <sh...@gmail.com>wrote:

> Thanks for that, that worked. I have used this feature before for the
> Cancel operation. Just did not occur to me.
> Cheers
>
>
>
> On Thu, Jul 22, 2010 at 3:41 PM, MattyDE <uf...@gmail.com> wrote:
>
>>
>> you could Try to set
>>
>>        /**
>>         * Sets the defaultFormProcessing property. When false (default is
>> true),
>> all validation and
>>         * form updating is bypassed and the onSubmit method of that button
>> is
>> called directly, and the
>>         * onSubmit method of the parent form is not called. A common use
>> for this
>> is to create a cancel
>>         * button.
>>         *
>>         * @param defaultFormProcessing
>>         *            defaultFormProcessing
>>         * @return This
>>         */
>>        public final Button setDefaultFormProcessing(boolean
>> defaultFormProcessing)
>>
>> to false.... on the AjaxButton (Button.class)
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Re-AjaxButton-OnSubmit-Validation-Overridden-tp2298251p2298256.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

Re: AjaxButton OnSubmit Validation Overridden

Posted by Nivedan Nadaraj <sh...@gmail.com>.
 Thanks for that, that worked. I have used this feature before for the
Cancel operation. Just did not occur to me.
Cheers


On Thu, Jul 22, 2010 at 3:41 PM, MattyDE <uf...@gmail.com> wrote:

>
> you could Try to set
>
>        /**
>         * Sets the defaultFormProcessing property. When false (default is
> true),
> all validation and
>         * form updating is bypassed and the onSubmit method of that button
> is
> called directly, and the
>         * onSubmit method of the parent form is not called. A common use
> for this
> is to create a cancel
>         * button.
>         *
>         * @param defaultFormProcessing
>         *            defaultFormProcessing
>         * @return This
>         */
>        public final Button setDefaultFormProcessing(boolean
> defaultFormProcessing)
>
> to false.... on the AjaxButton (Button.class)
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Re-AjaxButton-OnSubmit-Validation-Overridden-tp2298251p2298256.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: AjaxButton OnSubmit Validation Overridden

Posted by MattyDE <uf...@gmail.com>.
you could Try to set 

        /**
	 * Sets the defaultFormProcessing property. When false (default is true),
all validation and
	 * form updating is bypassed and the onSubmit method of that button is
called directly, and the
	 * onSubmit method of the parent form is not called. A common use for this
is to create a cancel
	 * button.
	 * 
	 * @param defaultFormProcessing
	 *            defaultFormProcessing
	 * @return This
	 */
	public final Button setDefaultFormProcessing(boolean defaultFormProcessing)

to false.... on the AjaxButton (Button.class)
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-AjaxButton-OnSubmit-Validation-Overridden-tp2298251p2298256.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org