IE 11 issue form getting submitted twice

Devildib
Devildib used Ask the Experts™
on
Hi Experts, I am working on a website written in  classic asp and .net.
There is a particular code snippet which needed a change.The flow is from a modaldialog popup which is an .asp page to another intermediate(without UI) .asp page for this change.No, aspx involved. AFter the change, on debugging via F12 developer tools, I see that for some reason, on IE button click, the code snippet fires twice while on firefox all is good.There is a single post seen for firefox.Below is my code snippet :Please Help.

if (window.opener== null)      {      
                                          
                                    window.dialogArguments.form1.action = "/includes/test.asp?page=somedotnetpage&id="+window.dialogArguments.form1.HidclientID.value;
                                    
                                    window.dialogArguments.form1.PIN.value = document.form1.pin.value;
                                    window.dialogArguments.form1.submit();
                        }
                        else {                                          
                                  window.opener.document.getElementById("form1").action = "/includes/test.asp?page=somedotnetpage&id="+opener.document.getElementById("HidclientID").value;
                                window.opener.document.getElementById("PIN").value = document.getElementById('pin').value;
                                                                              
                                    window.opener.document.getElementById("form1").submit();                                    
                        }
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
The button submit is written as :

<input type="button" id="btnSubmit" name="btnSubmit"  value="Submit" onclick="myfunction();"/>
Commented:
1) I don't know whether this is an issue, but I always have submit buttons as type=submit.

2) the onclick function must return a boolean value which if true causes a submit and if false cancels the operation. Your onclick must then be onclick="return myFunction()"  and myFunction must return false if it does the submit action itself.

HTH

Author

Commented:
I tried using return false but it did not work.Will changing type to submit and then using return false on top of it make any difference?
Commented:
It might. As I said I always have type=submit. In fact my onclick is onsubmit as well.

Author

Commented:
It was some flag causing the issue.But your comments will surely help in future.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial