Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dynamically create and submit a form in FireFox

Posted on 2007-11-15
2
Medium Priority
?
1,370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
gops1 earned 1000 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 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