Solved

Dynamically create and submit a form in FireFox

Posted on 2007-11-15
2
1,364 Views
Last Modified: 2013-12-07
This code works in IE and Opera, but not in FireFox, how do I make it work in FireFox:

function DoIt()
 {
                var sHTML = "";
                sHTML += '<FORM id="formBlah" method="POST" action="/save_blah.php">';
                sHTML += '<INPUT TYPE="hidden" NAME="courseId" VALUE=\'1\'>';
                sHTML += '<INPUT TYPE="hidden" NAME="certId" VALUE=\'1\'>';
                ...
                ...
                sHTML += '<br><input type="submit"><br>';
                sHTML += '</FORM>';
               
                document.getElementById("divBlah").innerHTML = sHTML;
                document.getElementById("divBlah").document.getElementById("formBlah").submit();
 }
....
....

<DIV id="divBlah" style="visibility:hidden">
</DIV>
0
Comment
Question by:mobile1
2 Comments
 
LVL 17

Accepted Solution

by:
gops1 earned 250 total points
ID: 20295304
Just use this:

document.getElementById("formBlah").submit();
0
 
LVL 3

Expert Comment

by:kylealanhale
ID: 20295339
There are a couple of things you can try.  One would be to give the submit button an id and call buttonId.click().  The other would be to use DOM functions instead of innerHTML.  If you don't want to build them from scratch, try my method for DOM building: http://jsoda.info/.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now