Solved

Dynamically create and submit a form in FireFox

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

756 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