Skip to content Skip to sidebar Skip to footer

Form Submit To Target Iframe Only Works Once

I'm having a really irritating problem doing something that I'm sure I've done before. The setup is this: There's a form which is submitted via a 'click' handler on a button, thou

Solution 1:

Well somehow my secondary "target" iframe seems to be losing it's "name" attribute, though I don't know how or when that happens. The <iframe> element itself still has the correct name, but the "window" object inside does not - even though code is trying to set it.

I am able to hack around the weirdness for now by having that "submit" code check for a targetted form, find the target iframe, and then make sure that its contentWindow has a "name" value that matches the "name" attribute on the iframe. How/why I have to do that, I don't know, and I'm sure it's due to something else I'm doing wrong.

Solution 2:

Ran into the same problem, but the form action was a different domain (the page doing the submitting is a local html file), so setting the contentWindow.name property isn't allowed. I managed to work around this problem by removing the iframe from the document and making a brand new iframe with the proper name before submitting the form again.

Post a Comment for "Form Submit To Target Iframe Only Works Once"