IE 11 issue form getting submitted twice

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();                                    
                        }
DevildibAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DevildibAuthor Commented:
The button submit is written as :

<input type="button" id="btnSubmit" name="btnSubmit"  value="Submit" onclick="myfunction();"/>
BigRatCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DevildibAuthor 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?
BigRatCommented:
It might. As I said I always have type=submit. In fact my onclick is onsubmit as well.
DevildibAuthor Commented:
It was some flag causing the issue.But your comments will surely help in future.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.