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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Field Binding

Status
Not open for further replies.

jrottman

Programmer
Jun 17, 2005
47
I have 10 form fields that require this document code to be placed into them. Instead of having to write 10 seperate versions of this pop up how can I dynamically change the fieldname.

Here is an example of hte setup I have right now. What I need to do is change the fieldname in opener.document.formname.fieldname.value to what what ever fieldname of the review number is (IE fld_review1)

I can get it to bind over in firefox, but when I try using IE it does not bind it over.

Here is my code


Form page
<input name="fld_review1" type="text" size="30">
<a href="##" onClick="javascript:popUp('includes/admin/doccode.cfm')">
<input type="submit" name="Submit" value=">"></a> </td>
<td><div align="center">
<input type="checkbox" name="fld_rev1_cor" value="checkbox">

Pop up:
<cfquery name="qGetCodes" datasource="#dsn#">
select *
from tbl_agentPortal_codecats
order by fld_doctype ASC
</cfquery>
<form name="form1" method="post" action="">
<select name="codeDisplay" size="10" >
<cfoutput query="qGetCodes">
<option value="#fld_doctype#-#fld_docline#" onClick="opener.document.form3['#URL.formId#'].value = document.form1.codeDisplay.value; self.close();">
#fld_doctype#-#fld_docline# </option>
</cfoutput>
</select>
</form>
 
MochaLatte,

You can pass the form field in the pop up call.

Like:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title></title>
<script>
function popUp(url){
var nwwin = window.open(url);
}

function PU(fn){
var html = '<html><head></head><body><form>\n\
<select onclick="opener.document.forms.f1.' + fn + '.value = this.value;">\n\
<option value="v1">Val 1\n\
<option value="v2">Val 2\n\
</select>\n\
</form>\n\
</body></html>';
var nwwin = window.open();
nwwin.document.open();
nwwin.document.write(html);
nwwin.document.close();
}

</script>
</head>
<body>
<form name="f1">
<input type="text" name="t1"
<br />
<a href="##" onClick="javascript:PU('t1')">Pop Up</a>
</form>
</body>
</html>


Hope it's helpful.

Good Place to "Learn More">>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top