Link to home
Start Free TrialLog in
Avatar of ID3TECH
ID3TECH

asked on

form.submit() does not work in sub window in FireFox

Greetings Experts,
In my current window, I need to populate a form in a hidden IFRAME element, then I need to submit it.
I tried :
- iframe.contentWindow.document.getElementById('myForm').submit();
 or calling a function in that IFRAME that submits the form
 or the __doPostBack of ASP .NET of that window

None of these work in FireFox, and they do not even fire errors, so I do not know what to look for anymore.
Do any of you has an idea of how to bypass this?
Thank you experts.
Avatar of smaccari
smaccari

If your Iframe is named "myFrame", do this:

frames["myframe"].document.getElementById('myForm').submit();

or

frames["myframe"].__doPostBack();
Avatar of ID3TECH

ASKER

nah, this is not the problem, I have the form object int he new window, and when I do an alert of the form.submit, it is indeed a function, but when I call it, nothing happens
Is it possible to have some of your code? Both main page and iframe?
Avatar of Michel Plungjan
No errors in the javascript console?

1. make sure you have <form></form>
2. make sure you do NOT have anything name="submit" or id="submit"
3. use the form access:
window.iframeName.document.forms[0].submit()
will submit the first form in the iframe unless of course the content of the iframe is not from the same server (that also means portnumber and protocol)

Michel
Avatar of ID3TECH

ASKER

Thanks for the help, but I just figured out it was because the Frame's style.display was set to none, so the javascript could not execute.
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial