An idea:

in Form#onSubmit() check whether the current request is Ajax: if
(AjaxRequestTarget.get() != null) return; // i.e. do not execute the method'
body

You can even check whether the submittingComponent is the AjaxButton and do
nothing in that case only

On Wed, Jan 5, 2011 at 1:19 PM, Marek Pribyl <mr.pri...@gmail.com> wrote:

> hi all,
> I have form with two submit buttons & want different behavior for each
> button.
>
> submitButton:
> - standard submit button
> - expected "onClick" behavior: validate form & save the form's model
> (implemented in form's onSubmit() method) & redirect to another page
>
> ajaxButton:
> - AjaxButton
> - expected "onClick" behavior: validate form, if valid get form's model
> & display it as XML in modal window for preview
>
> the problem is that form's onSubmit() is called when I click on
> ajaxButton - I need to keep validation but do not call form's onSubmit()
> method, i.e. stay on the current form page & do not save the model.
> Is there any chance to do this wicket way?
>
> thanks,
> marek
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to