Jump to content

Submitting a form within iframe


mooz

Recommended Posts

Hi there,

 

I am trying to automatically submit a form in an iframe with javascript. My question is whether this is possible or not, and if so how the code should look like to submit the form in the iframe?

 

this is the form within the iframe that I am trying to submit automatically:

<form style="clear: left; padding: 20px 5px 0 0" id="Form2051051" action="nieuw-bericht.2051051.lynkx" method="post" class="form" onsubmit="return ProcessForm( 'Form2051051' );">
<div>
	<a href="#" onclick="document.getElementById( 'event' ).value='Step1'; document.getElementById( 'Form2051051' ).submit(); return false;" class="button previous"><span>Wijzig</span></a>
	<a href="#" onclick="if ( ProcessForm( 'Form2051051' ) ) document.getElementById( 'Form2051051' ).submit(); return false;" class="button next-long"><span>Plaats bericht</span></a>
</div>
	<input type="hidden" id="event" name="event" value="Confirmed-Step3" />
	<input type="hidden" name="PostedField[_berichtId]" value="" />
	<input type="hidden" name="formState" value="KQAAAAoAAAEAAgADAAQABQA9taWULZGFzZGFzIHNhZGEA" />
</form>

 

this is what I have tried so far:

<body  LANGUAGE="javascript" onload="window.frames['myframe'].document.getElementById( 'Form2051051' ).submit();">
<iframe name="myframe" id="frame1" src="link-to-the-page-with-the-form">
</iframe>
</body>

 

I am pretty new with this so I appreciate any help or suggestions!

 

thank you

Link to comment
Share on other sites

Hi,

The webpage within the iframe is from an external website (im not in control of it). I did some more research and have read that it's not possible to use  javascript on webpages in iframes that are not within my domain. Is this true? and if so is there any alternative to auto submit a button in an iframe?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.