PDA

View Full Version : Iframes and form submit...help :(


Gibson
10-02-2006, 01:25 PM
Hi,

I need a bit of help on javascript code(i know very little about it!)

I have 2 forms, One on the mainpage and the other in an iframe on the main page.

What i would like to do is when i submit the form on the main page it will also submit the form in the iframe.

Can any one help please ?

Many thanks

joe

cycleops
10-02-2006, 07:16 PM
I suppose you could generally write to it with:
document.your_i_frame_name.document.write('yadda,yadda');

And i guess you'd submit with:
document.your_i_frame_name.document.your_form_name.submit();

I haven't tried it though.

Gibson
10-04-2006, 10:09 AM
Hi,

I managed to find the solution here it is:

<FORM>
<INPUT TYPE="BUTTON" onClick="parent.frameName.document.formName.buttonName.click()">
</FORM>

Hope that helps some one in the future

Joe

Kor
10-04-2006, 10:18 AM
You should rather use straight the submit method than emulate the click() event (which could not be crossbrowser)

onclick="parent.frameName.document.formName.submit()"

- but make sure there is no element with the name or id = "submit"

Gibson
10-04-2006, 04:30 PM
Hi,

Quite a few people gave me that submit piece at the end but i never worked i kept getting errors on my main page. I dont have any buttons named submit so its sort of annoying lol :)

Many thanks

Joe