This is a round about way of doing it.
Just threw this together.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<cfif IsDefined("url.custNum")>
<CFQUERY NAME="q1" DATASOURCE="YOURDSN" DBTYPE="ODBC">
SELECT CNME
FROM RCML02
WHERE CCUST = #URL.custNum#
</CFQUERY>
</cfif>
<html>
<head>
<title>Populate field based on query in javascript</title>
<script language = "JavaScript">
<!--
function populate(){
window.location="popInJavascript.cfm?custNum="+document.form1.custNum.va
lue;
}
//-->
</script>
</head>
<body>
<form method="post" name="form1">
Select customer #:
<select name="custNum" onchange="populate();">
<option value="1704">1704</option>
<option value="8199">8199</option>
<option value="2019">2019</option>
<option value="1704">1704</option>
</select><br>
Customer Name:
<cfif IsDefined("url.custNum")>
<input type="text" name="custName"
value="<CFOUTPUT>#q1.CNME#</CFOUTPUT>">
<cfelse>
<input type="text" name="custName">
</cfif>
</form>
</body>
</html>
Ron Mast
Webmaster
Truth Hardware
Ph: 507-444-4748
Fx: 507-444-5361
www.truth.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Laila Oommen
Sent: Tuesday, June 21, 2005 6:06 PM
To: [email protected]
Subject: onChange=populate()
Has any one got a script to make this work?
When the code is selected, I want the city and the state to be populated
with values from database.
<script language="javascript">
function populate()
</script>
<tr>
<td>CODE</td>
<td colspan="2">
<select name="code" onChange=populate()>
<option selected>Select one</option>
<cfquery name="getvalues">
SELECT DISTINCT code
FROM tblRegion
</cfquery>
<cfoutput query="code">
<option value="">#code#</option>
</cfoutput>
</select>
</td>
</tr>
<tr>
<td>CITY</td>
<td><input type="text" name="city"></td>
</tr>
<tr>
<td>STATE</td>
<td><input type="text" name="state"></td>
</tr>
Thanks
Laila
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm
_______________________
This e-mail and any files transmitted with it are confidential and are intended
solely for the use of the individual to whom they are addressed. If you are
not the intended recipient or the individual responsible for delivering the
e-mail to the intended recipient, please be advised that you have received this
e-mail in error and that any use, dissemination, forwarding, printing, or
copying of this e-mail is strictly prohibited.
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe:
http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe:
http://www.dfwcfug.org/form_MemberRegistration.cfm