javascript - Confirm Save during onchange of drop down -


Changing the Selection Option I am confirming the user whether to save the changes or not, if the user selects the right one, So I am submitting the form automatically. Onchange = "If (Confirm ('Save?')) {This.form.gridedit.click ();}" When the user chooses to cancel, he is currently populating the selected option. My problem is that I have to populate the old value if the user selects the option to cancel the confirmation message. Please help anybody on this issue thanks

Try this, do not think that you can complete it without some manual work.

  & lt; Script type = "text / javascript" & gt; Var ddHelper = {previousIdx: null, store: function (E, DD) {this.previousIdx = dd.selectedIndex; }, Confirm: Function (E, DD) {if!! Window.confirm ('save?') {Window.setTimeout (function () (// think that you need setTimeout for some browsers dd.selectedIndex = ddHelper .previousIdx;}, 0); }}}; & Lt; / Script & gt; & Lt; Onfocus = "ddHelper.store (event, this) Select" onchange = "ddHelper.confirm (event, this">   

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -