> I�m hacking at Javascript, what this script is supposed to
> do is pass form values back to another form (click on a
> button, select a record, and the record data is posted
> back to the previous form etc.). The selection form is
> based on a query, so it�ll change based on how many
> records it returns.

You really ought to name your form in the parent document rather than
using forms[0] which is liable to bite you in the ass later.

<form name="specialformname">
self.opener.document.forms.specialformname.clientID.value = clid;

You're missing { and } around your loop code... and you should add
semicolons to each line -- intepreters allow you to get away with not
including the semicolon, but that's sloppy. The variables compName and
clid should be declared with the var keyword... so should the variable
i. It's the same as ColdFusion functions -- it'll bite you in the ass
later if you don't.

var compName = null;
var clid = null;

for (var i=1; i<<cfoutput>#qry_getClient.recordcount#</cfoutput>;i++)
{
  clid = document.clientSearch.client_id[i].value;
  compName = document.clientSearch.company[i].value;
  self.opener.document.forms.myform.clientID.value = clid;
  self.opener.document.forms.myform.coName.value = compName;
}

More importantly I don't think this function will do what you want...

Unless what you want is to set the value of a single company and
clientID input elements in the parent window several times in rapid
succession before finally bringing them to rest with a single value.
:P In other words, this code would produce the same end-result as if
you had removed the loop all-together and simply set the value of "i"
to #qry_getClient.recordcount# and only populate the form with the
values from the last record. So if you want to get the values from an
item in the list by using links in the list to determine which item
was selected, you want to add an argument or two to your function. Try
this:

function clientRecPop(i) {
  var compName = null;
  var clid = null;

  clid = document.clientSearch.client_id[i].value;
  compName = document.clientSearch.company[i].value;
  self.opener.document.forms.myform.clientID.value = clid;
  self.opener.document.forms.myform.coName.value = compName;
}

The error you're getting specifically has nothing to do with these
problems btw... it can't find your "clientSearch.client_id" object,
either because you left out the word "form" or mis-spelled the form
name or some other reason... you might try
document.forms.clientSearch.client_id

hth


s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206248
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

Reply via email to