IE 11 cannot submit an HTML form
Solution 1
I believe this is a bug when setting form values to empty in IE.
I would suggest trying a different method to resetting the form values, I have used this method in the past:
document.getElementById('name').parentNode.innerHTML = '';
Solution 2
Maybe not your issue, but:
<input type="submit" name="submit" ... >
Giving a form control a name of submit will replace the form's submit method with a reference to the control, so calling form.submit()
will attempt to "call" the input.
Solution 3
hi might be problem in your code you miss to add id in form and you try to access form by it's id that you not define.
document.getElementById("nextform").submit();
its required
<form name="nextform" id="nextform" action="anotherpage.php" method="post" enctype="multipart/form-data">
...
...
...
</form>
slevin
aspiring web developer - html5 and web mapping enthusiast. mainly work with apache, geoserver, openlayers, html5, php, mysql, postgresql/postgis, javascript, jquery SOreadytohelp
Updated on March 15, 2020Comments
-
slevin about 4 years
I have this HTML form
<form name="nextform" action="anotherpage.php" method="post" enctype="multipart/form-data"> <input name="pinid" id="pinid" type="hidden"> <input type="submit" name="submit" id="post" value="Lets Go" class="formButtonMap"> </form>
pinid
dynamically gets a value using JavaScript. When it gets a value I alert it and it works.But, when I click the
Lets Go
button, nothing happens. I see the Internet Explorer loading for a couple of minutes and then I get the message “The webpage does not respond”. If I hit refresh it goes toanotherpage.php
but the values from the form did not arrive to the server.Rarely shows this message:
Visual Studio Just-In-Time Debugger
An unhandled win32 exception occured in iexplorer.exe [688]
Possible Debuggers :
New Instance of Microsoft Visual Studio 2012
This behavior is observed only in Internet Explorer 11.0.2. The form works in older versions of Internet Explorer and also in Chrome and Firefox. I get no errors in IE’s console.
Here is the JavaScript code, placed above the form:
// called when another button is clicked - basicaly is websockets function save() { var so = new WebSocket("ws://localhost:8000"); so.onerror = function (evt) { alert('problem'); } if (sara == 'LINES') { so.onopen = function() { so.send(JSON.stringify({ command: 'insertAll', name: document.getElementById('name').value })); } } if (sara == 'POLY') { so.onopen = function() { so.send(JSON.stringify({ command: 'insertHalf', name: document.getElementById('name').value })); } } so.onmessage = function (evt) { var received_msg = evt.data; document.getElementById("next").style.display = "block"; document.getElementById("name").value = ""; document.getElementById("descr").value = ""; clearLinks(); document.getElementById("pinid").value = received_msg; alert(document.getElementById("pinid").value); // works so.close(); } }
I tried to edit the code using
document.getElementById("nextform").submit();
, problem is still there.Is it me? Is it a bug? What am I missing?
-
slevin over 10 yearsNice piece of advice, but nothing changed. Problem is still there
-
RobG over 10 yearsAs I said, "maybe not your problem", it's just advice.
-
slevin over 10 yearsI know, and thanks for your time again. I have tried everything. Change the structure of JS, use
GET
instead ofPOST
. Drives me crazy, cannot solve it. Maybe any other advise? Anything will do. I cannot make it work. -
J.D. Pace over 10 yearsCan you provide a little context around this, and maybe your thoughts behind this approach? I looked at the workaround posted with the bug report but cannot implement because I'm not using jQuery. IE11 is crashing when entering data in a form for me -- I assumed it had something to do with auto-suggest, but can't debug to that end.
-
slevin over 10 years@Andrew Yes, has to do with that bug you mention. I tried the workaround there, and worked for me. My original code has a form with more than 5 fields. When submitted calls the
save()
. That function also clears the fields using JS. The bug in that form crashes thenextform
form and also the browser. I APOLOGISE for not posting all my code, I did not know it had to do with the first form. I did NOT asked the same question twice. Because I thought the same code had two different problems. Turns out , its the same problem. I asked this one first.Thanks anyway -
Andy over 10 yearsNo worries @slevin, it just confused me as it appeared as though you were asking the same question. I'm glad the workaround has helped you.