MayoorPatel
asked on
Capturing the value of form elements on submit within an Iframe
Hi there I have a form with various form elements on it, textboxes, e.t.c I also have 4 iframes which hold form elements. At the moment when I submit the form the values of the iframes are not being submitted, only the values on the parent form are being submitted. Is there anyway I can capture the values of the iframes as well as the parent form values?
Here is an example of the Iframe.
<iframe
src = 'clientdrp.asp'
id = 'ifrClient'
name = 'ifrClient'
frameborder = '0'
width = '230'
height = '20'
marginwidth="0"
marginheight="0"
hspace="0"
vspace="0"
border="0"
scrolling="no">
</iframe>
and here is an example of the content within that Iframe.
<div id="menu" style="position: absolute; top: 0px; width: 436px; left: 0px;" align=left>
<select name="ContactID" size="1">
<option value="0">-- Please Select A Contact--</option>
<%
Do Until objRSProjectManagerList.EO F
Response.Write("<option value=""" & objRSProjectManagerList.Fi elds("Id") & """>" & objRSProjectManagerList.Fi elds("Firs tName") & " " & objRSProjectManagerList.Fi elds("Last Name") & "</option>")
objRSProjectManagerList.Mo veNext
Loop
Set objRSProjectManagerList = Nothing
%>
</select>
</div>
as you can see the name of that dropdown is ContactID, so if I could capture that, it woujld be great.
Thanks in Advance!
Here is an example of the Iframe.
<iframe
src = 'clientdrp.asp'
id = 'ifrClient'
name = 'ifrClient'
frameborder = '0'
width = '230'
height = '20'
marginwidth="0"
marginheight="0"
hspace="0"
vspace="0"
border="0"
scrolling="no">
</iframe>
and here is an example of the content within that Iframe.
<div id="menu" style="position: absolute; top: 0px; width: 436px; left: 0px;" align=left>
<select name="ContactID" size="1">
<option value="0">-- Please Select A Contact--</option>
<%
Do Until objRSProjectManagerList.EO
Response.Write("<option value=""" & objRSProjectManagerList.Fi
objRSProjectManagerList.Mo
Loop
Set objRSProjectManagerList = Nothing
%>
</select>
</div>
as you can see the name of that dropdown is ContactID, so if I could capture that, it woujld be great.
Thanks in Advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brilliant thanks!
<script>
function getContact() {
if (window.frames.length==0) return ""; // no iframes here
var ifr = window.frames['ifrClient']
if (!ifr) return ""; // no iframe called ifrClient here
var sel = ifr.document.forms[0].Cont
return sel.options[sel.selectedIn
}
</script>
<form onSubmit="this.hiddenConta
<input type="hidden"name="hiddenC