Question

There is a rather simple html application.

Changing text field will cause a submit, follow by a redraw. Pressing button will cause a submit, too.

When changing a field and leave it by pressing a button, the browser run into a conflict. The browser starts one submit, aborts it and do the next submit. The result is unreliable.

Is there a simple solution to get one submit with button and field without switching to some AJAX approach (say GWT)?

Was it helpful?

Solution

You could cancel any other event handler when starting to submit the form. This is similar to disabling a submit after clicking it, to prevent the form being submitted twice by impatient users.

OTHER TIPS

You can send a flag that will tell if submit function has called once, if submit already called then don't call submit for this user.

OR you can disable the submit button as soon as call the function from text field change, in this way user will not be able to click on the submit button.

Might help you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top