• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

request value from iframe

Hello,

I have a main asp page and a submit button on it,

In the main page i also have an iframe, the iframe src is also another asp page which has a form with text inputs in it.

My question is how can i request the information located in the iframe form
when i click the submit button in the main page

thank you

0
regevli
Asked:
regevli
  • 2
1 Solution
 
rockymageeCommented:
PUT THIS INFORMATION IN YOUR FORM WITHIN THE IFRAME:
(notice the action is the main page [main.asp] and the target is [parent])

<form action="main.asp" name="passToParent" target="_parent">
<input type="text" size="10" name="testVariable" value="">
<input type="submit" value="Pass to Parent">
</form>
0
 
rockymageeCommented:
I think I may have read your question wrong: you want the submit button in main page:

Main Page:

<script language="javascript"><!--
function pullData(thisObj){
  var getValue = document.inf.ptp.tv.value;
  document.getElementById(thisObj).value=getValue.toString();
}      
//--></script>
<iframe src="page2.asp" name="inf" height="60" width="140"></iframe>

<form name="mf">
 <input id="pv" type="text" readonly="readonly"><br>
 <input type="button" value="Get iframe value" onclick="pullData('pv');">      
</form>

_____________________________________________________________________

Form on page2.asp:

<form name="ptp">
  <input type="text" size="10" name="tv" value="">
</form>


0
 
regevliAuthor Commented:
yes this is what im looking for but my pages are asp pages and in the main page i already have a submit button,
so i need a way to collect the information from the form in the iframe using server side script.

think of it like an order page , in the main page i have the order header and in the iframe i have the order lines,

i need to store the order lines and the order headers in the database using the same submit button which is located in the main form.
but at the moment i dont know how to collect the information from the form located inside the iframe

do you have an idea how to do it ?
0
 
rangasumanCommented:
rockymagee's second is a correct answer. You need to call the values from the iframe like this
document.<iframename>.<formname>.<inputfieldname>.value;
Replace the <> with their corresponding values. Hope that helps.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now