Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing selected value in an IFrame

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
I'm needing to build a dynamic entry form - where the person putting in information can add to the list of criteria. But with ASP you need to refresh the page for the dropdown to show the new criteria.

So I figured IFRAME, I could just do a refresh there without loosing the rest of the page of entered info.

But how do I grab the value from the iframe?

Earlier balajees responded with
You can refer the iframe using

self.frames['nameoftheiframe']

ex:

<iframe name=DataFrame src='data.asp' >
</iframe>

you can refer the contents of the iframe as
self.frames['DataFrame'].document.form1.text1.value


but I get this error


Expected end of statement

/admin/addentries2.asp, line 37

rs5(&quot;fldSalesPerson&quot;)= self.frames['salesframe'].document.form1.fldsalesperson.value
any ideas?
&quot;Insert witty remark here&quot;

Stuart
 
You are mixing your languages, I think.

I guess what balajees ment was, that you could reference the contents clientside using the reference described.

What you need to do, is to place som clientside script in the containing document that retrieves the contents of the iframe and inserts it into a hidden field in the container-document and then submits it all to the asp-script...

Does that make sense?!

I imagine something like:

Container-document:
Code:
<form name=theForm onSubmit=&quot;DoTheThingy&quot; method=post action=something.asp>
<input type=hidden name=iframecontents>

<script language=javascript>
function DoTheThingy() {
theForm.iframecontents.value = self.frames['DataFrame'].document.form1.text1.value
}
</script>

Something.asp:
Code:
strIFrameStuph = request.form(&quot;iframecontents&quot;)
This is not a bug - it's an undocumented feature...
;-)
 
anyway!: I'm off for tonight - see you all in the morning!

~J This is not a bug - it's an undocumented feature...
;-)
 
hmmm so on the form page when it's submitted
your putting the values into hidden fields by way of calling javascript.

this gets submitted to another page submit.asp or whatever that will have the value's Dim'd

and away it goes.

&quot;Insert witty remark here&quot;

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top