This probably isn't the best way, but you could possibly move all of your
onSubmit code to the form's on submit, including the request target stuff.

Just do RequestCycle.get().getRequestTarget()  (or there maybe
AjaxRequestTarget.get() - I can't remember).

That's not a true "fix" but at least it gets rid of the duplicate code
issue.  Someone else may have a suggestion on how to do a real fix.

-- 
Jeremy Thomerson
http://www.wickettraining.com


On Wed, Feb 25, 2009 at 11:57 AM, Wayne Pope <
waynemailingli...@googlemail.com> wrote:

> Hi,
>
> I have a form that has a single text field and an ajax button.
> In FF when I click on the button or hit return key the onSumit of the
> ajaxButton is called.
> In IE when I click on the button the onSubmit of the ajaxButton is called.
> However
> In IE (as you may know) if I hit the return key it submits the form
> and the form's onSubmit method is be called instead of the ajaxButton
> so the page just refreshes.
> If I add the onSubmit to the form, in FF if I click on the button ,
> first the onSubmit of the form is called, then the ajaxButton
> onSubmit, and we end up with double the submits
>
> Aside from disabling the return key via javascript - not really an
> option as its just bad usability for us - any suggestions on how to
> handle this in a more elegant way?
>
> For the moment I've used form.isSubmitted() in the ajaxButton
> onSubmit, but it means I have to duplicate some of the code between
> the 2 onSubmits to control ajaxrequestTarget .
> thanks
> Wayne
>
>
>
>
>
>
> www.glasscubes.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to