Be careful with the private variables outside of your function scope.
You might think you made them private, but in fact they are public
because you have defined them outside the function. You have defined
them as global variables now.
I have enclosed the parts with try catch parts, which might help you
finding out where it goes wrong.
<script type="text/javascript">
function clientRecPop(i) {
if(parseInt(i) <= 0){
alert('i contained is not a valid number');
return;
}
try{
var clid =
document.forms['clientSearch'].elements['client_id'+i];
var compName =
document.forms['clientSearch'].elements['client_id'+i];
}catch(e){
alert('something went wrong in the first part, fields
not existing etc.');
}
if(window.opener){
try{
window.opener.document.forms['NewJob'].elements['clientID'].value =
clid;
window.opener.document.forms['NewJob'].elements['coName'].value =
compName;
}catch(e){
alert('something went wrong in the second part, fields
not existing in opener window etc.');
}
}
//window.close()
}
</script>
Micha Schopman
Project Manager
Modern Media, Databankweg 12 M, 3821 AL Amersfoort
Tel 033-4535377, Fax 033-4535388
KvK Amersfoort 39081679, Rabo 39.48.05.380
------------------------------------------------------------------------
------------------------------------------------------------------------
-----
Modern Media, Making You Interact Smarter. Onze oplossingen verbeteren
de interactie met uw doelgroep.
Wilt u meer omzet, lagere kosten of een beter service niveau? Voor meer
informatie zie www.modernmedia.nl
------------------------------------------------------------------------
------------------------------------------------------------------------
-----
-----Original Message-----
From: SStewart [mailto:[EMAIL PROTECTED]
Sent: dinsdag 10 mei 2005 20:52
To: CF-Talk
Subject: RE: Dynamic Javascript Question
I'm still getting the same errors
Here's the code (html generated from CF)
The size of the form is dictated by a cfoutput query.
<script>
var i = null;
var compName = null;
var clid = null;
function clientRecPop(i) {
clid = document.forms.clientSearch.client_id[i];
compName = document.forms.clientSearch.company[i];
self.opener.document.forms.NewJob.clientID.value = clid;
self.opener.document.forms.newJob.coName.value =
compName;
//window.close()
}
</script>
</head>
<body id="clientSearch">
<table width="100%" border="0" cellpadding="0">
<tr bgcolor="#CCCCCC">
<td><span class="style5">*</span></td>
<td><span class="style5">Client #</span></td>
<td><span class="style5">Client Company Name</span></td>
<td><span class="style5">Contact Name</span></td>
<td><span class="style5">Phone#</span></td>
<td> </td>
</tr>
<form action="" method="post" name="clientSearch" id="clientSearch">
<tr>
<td><input name="Status1" type="text" value="A" size="2">
</td>
<td><input name="client_id1" type="text" value="158903"
size="10"></td>
<td><input name="company1" type="text" value="Wal-Mart Stores, Inc
"></td>
<td><input name="contact1" type="text" value="Mohsen Ghadimkhani
"></td>
<td><input name="phone1" type="text" value="5012734940 "
size="10"></td>
<td><input name="recID1" type="button" onClick="clientRecPop(1)"
value="Select"></td>
</tr>
<tr>
<td><input name="Status2" type="text" value="A" size="2">
</td>
<td><input name="client_id2" type="text" value="158904"
size="10"></td>
<td><input name="company2" type="text" value="Wal-Mart Stores, Inc.
"></td>
<td><input name="contact2" type="text" value="Wayne Cox
"></td>
<td><input name="phone2" type="text" value="5012734734 "
size="10"></td>
<td><input name="recID2" type="button" onClick="clientRecPop(2)"
value="Select"></td>
</tr>
Scott A. Stewart,
Web Application Developer
Engineering Consulting Services, Ltd. (ECS)
14026 Thunderbolt Place, Suite 300
Chantilly, VA 20151
Phone: (703) 995-1737
Fax: (703) 834-5527
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 05/10/2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206312
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54