Archive for the ‘ iFrame ’ Category

How to submitting from inside of iFrame from Outside of iFrame


In case of situation like that a form which is inside of iframe but I  need to submit it from outside of iframe.

<iframe name=”displayframe” src=”display.php” width=”100%” height=”650px” style=’border:none’ >

<form action=”<?php echo $base_index.$action;?>” method=”post” enctype=”multipart/form-data” name=”formdisplay” id=”formwork”>
<input type=”hidden” id=’base’ value='<?php echo $base_index?>’ />

<table width=”522″ border=”0″ align=”center”>
<tr>
<td align=”right”><b>Title:</b></td>
<td colspan=”4″><label>
<input name=”title” type=”text” id=”title” size=”50″  />
</label></td>
</tr>
<tr>
<td align=”right”><b>Description:</b></td>
<td colspan=”4″><label>
<textarea name=”description” rows=”5″ cols=”30″ style=”width:600px” >
</textarea>
</label></td>
</tr>

</table>
</form>

</iframe>

<input type=”button” name=”insert” id=”button” onclick=”submitDisplayForm()” value=”submit” />

and my JavaScript code is

<script type=”text/javascript”>

window.frames[‘displayframe’].document.forms[‘formdisplay’].submit();

</script>

in this javascript code “displayframe” is the name of iframe and “formdisplay” is the name of form which is inside of iframe.

Thats all i have done so far.