Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button and onchange in html form

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)?

like image 471
stefan bachert Avatar asked Nov 13 '22 19:11

stefan bachert


1 Answers

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.

like image 112
feeela Avatar answered Nov 15 '22 10:11

feeela