Good morning!
I'm having a problem where there is probably a very simple solution, but I'm up against a very rigid time schedule, and I could use some help resolving this issue.
I have an application that consists of CF (ver 5) and imbedded Javascript for form/data validation; dynamic loading of data in forms, etc. I have a CF query that selects data from a SQL table that is needed to fill a number of fields in a form that created in Javascript. I can create a CF array and get the data needed loaded in the array (single dimension) just fine. The code below shows the CF code and a sample of the data in the array. What I need to be able to do is access the data from within Javascript code so that I can place the individual elements in the form. I know that there is something very basic that I'm missing here, but with all the other aspects of the application that are consuming me, I can't seem to focus on the solution! Any help would, of course, be greatly appreciated.
The CF code:
*******************************************************
*******************************************************
<cfquery name="test2x" dbtype="query">
SELECT contract,
job_cd,
st_hr,
stlabor,
fy,
fymon,
mon,
mon3
FROM test1x
WHERE mon3 = 'xxx'
ORDER BY contract,
job_cd,
fy
</cfquery>
<cfset CstArray1 = ArrayNew(1)>
<cfset Res1 = ArrayClear(CstArray1)>
<cfif test2x.recordcount>
<cfoutput query="test2x">
<cfset ThisItem=ArrayLen(CstArray1) +1>
<cfset CstArray1[ThisItem]=test2x.stlabor>
</cfoutput>
</cfif>
<cfloop index = "Order" from = "1" to = "#ArrayLen(CstArray1)#">
<cfoutput>CstArray1[#Order#] value is #CstArray1[Order]#</cfoutput><br>
</cfloop>
*********************************************************
*********************************************************
And a printout of the data:
*********************************************************
*********************************************************
CstArray1[1] value is 291.00
CstArray1[2] value is 3819.00
CstArray1[3] value is 754.00
CstArray1[4] value is 221.00
CstArray1[5] value is 4988.00
CstArray1[6] value is 3121.00
CstArray1[7] value is 2020.00
CstArray1[8] value is 3356.00
CstArray1[9] value is 14465.00
*********************************************************
*********************************************************
This is the correct data (in this example) that needs to be loaded in the Javascript form.
Thanks!
Bill
Bill
lohneb@bellsouth.net
I'm having a problem where there is probably a very simple solution, but I'm up against a very rigid time schedule, and I could use some help resolving this issue.
I have an application that consists of CF (ver 5) and imbedded Javascript for form/data validation; dynamic loading of data in forms, etc. I have a CF query that selects data from a SQL table that is needed to fill a number of fields in a form that created in Javascript. I can create a CF array and get the data needed loaded in the array (single dimension) just fine. The code below shows the CF code and a sample of the data in the array. What I need to be able to do is access the data from within Javascript code so that I can place the individual elements in the form. I know that there is something very basic that I'm missing here, but with all the other aspects of the application that are consuming me, I can't seem to focus on the solution! Any help would, of course, be greatly appreciated.
The CF code:
*******************************************************
*******************************************************
<cfquery name="test2x" dbtype="query">
SELECT contract,
job_cd,
st_hr,
stlabor,
fy,
fymon,
mon,
mon3
FROM test1x
WHERE mon3 = 'xxx'
ORDER BY contract,
job_cd,
fy
</cfquery>
<cfset CstArray1 = ArrayNew(1)>
<cfset Res1 = ArrayClear(CstArray1)>
<cfif test2x.recordcount>
<cfoutput query="test2x">
<cfset ThisItem=ArrayLen(CstArray1) +1>
<cfset CstArray1[ThisItem]=test2x.stlabor>
</cfoutput>
</cfif>
<cfloop index = "Order" from = "1" to = "#ArrayLen(CstArray1)#">
<cfoutput>CstArray1[#Order#] value is #CstArray1[Order]#</cfoutput><br>
</cfloop>
*********************************************************
*********************************************************
And a printout of the data:
*********************************************************
*********************************************************
CstArray1[1] value is 291.00
CstArray1[2] value is 3819.00
CstArray1[3] value is 754.00
CstArray1[4] value is 221.00
CstArray1[5] value is 4988.00
CstArray1[6] value is 3121.00
CstArray1[7] value is 2020.00
CstArray1[8] value is 3356.00
CstArray1[9] value is 14465.00
*********************************************************
*********************************************************
This is the correct data (in this example) that needs to be loaded in the Javascript form.
Thanks!
Bill
Bill
lohneb@bellsouth.net