Guest_imported
New member
- Jan 1, 1970
- 0
I'm using ColdFusion and a MS SQL7 database.
I have a number of text boxes on a form and what I need to do is fill in some of these fields automatically after the user types in info in two boxes. So what I'm doing is, the user fills in two boxes and with the "onchange" method, I'm calling a javascript function that first queries a table and then I need to populate some of the other fields on the form with the results from this query. Here is the function:
<SCRIPT LANGUAGE="javascript">
function find_info() {
if (document.myForm.CMD_DSG.value == ""
{
alert("You must fill in the CMD DSG field!"
;
return false;
} else {
<CFQUERY NAME="Get0000" datasource="mynsnsql">
SELECT *, (fiacd_1+fiacd_2+fiacd_3+fiacd_45) as fiacd
FROM cmad0000
WHERE maj_key = ('C'+'C97R0030CZ')
</CFQUERY>
<CFOUTPUT QUERY="Get0000">
document.myForm.FIA_CD.value = "#fiacd#";
document.myForm.NSN.value = "#nsn#";
</CFOUTPUT>
return true;
}
}
</script>
When I hard code the info in the where clause, everything works fine, but my problem is, how can I get javascript to pass the values of these two fields into the where clause?
I have a number of text boxes on a form and what I need to do is fill in some of these fields automatically after the user types in info in two boxes. So what I'm doing is, the user fills in two boxes and with the "onchange" method, I'm calling a javascript function that first queries a table and then I need to populate some of the other fields on the form with the results from this query. Here is the function:
<SCRIPT LANGUAGE="javascript">
function find_info() {
if (document.myForm.CMD_DSG.value == ""
alert("You must fill in the CMD DSG field!"
return false;
} else {
<CFQUERY NAME="Get0000" datasource="mynsnsql">
SELECT *, (fiacd_1+fiacd_2+fiacd_3+fiacd_45) as fiacd
FROM cmad0000
WHERE maj_key = ('C'+'C97R0030CZ')
</CFQUERY>
<CFOUTPUT QUERY="Get0000">
document.myForm.FIA_CD.value = "#fiacd#";
document.myForm.NSN.value = "#nsn#";
</CFOUTPUT>
return true;
}
}
</script>
When I hard code the info in the where clause, everything works fine, but my problem is, how can I get javascript to pass the values of these two fields into the where clause?