Solved

Dynamically create and submit a form in FireFox

Posted on 2007-11-15
2
1,369 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

630 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