Hi group,

Consider the follow situation:
- A ModalWindow is shown using a AjaxFormSubmitBehavior on the onchange of
an inputfield. The ModalWindow has a informative message and an Ok button
for the user to click if the message is read and understood. Pretty much
comparable to a properly styled javascript alert.
- Say user enters that fields, types some text and doesn't leave the field
(so onchange is not triggered!)
- Say the user now clicks a (non-ajax) SubmitButton or SubmitLink
- The onchange is now triggered by the browser, so the AJAX request is
started (because the focus is switched to the form button)
- At the same time, the browser does a normal HTTP POST (triggered by the
button click)
- Of course, this leads to unwanted behavior, depending on how fast the ajax
response is sent and processed.

The simple fix would seem to change the buttons and links to their AJAX
equivalent, with leads to deterministic behavior (since the ajax events are
queued), but still unwanted behavior: an ugly 'are you sure you want to
navigate away from this page' confirmation is shown. If we turn the
confirmation off, the page changes even if the user doesn't click the Ok
button.

How can we prevent this? I think the root of the problem is that it seems
hard to prevent a AjaxFormSubmitBehavior and a 'normal' form submit being
executed directly after each other. Is there some way to prevent additional
ajax (submit) events from being queued if there is still a running event? Or
are we going at it the wrong way?

Regards,
Vincent

Reply via email to