Question
CF query and Javascript
hi Guys,
Im trying to creat a dynamic javascript list, populating it using a CF query.
Can anyone tell me how I can loop through the query and set the options of the list?
Here is my code but it doesnt work.
Please help
Thankyou
-------------------------------------
<CFquery name="avequipment" datasource="itsupport" username="#dsn_username#" password="#dsn_password#">
SELECT Equipment FROM JL_av_items ORDER BY Equipment
</cfquery>
//add options to equipment select list
var recordcount = '<cfoutput>#avequipment.recordcount#</cfoutput>';
for(t=1; t<=recordcount; t++)
{
theOption=document.createElement('option');
theText=document.createTextNode('<cfoutput>#equipment#</cfoutput>');
theOption.appendChild(theText);
theOption.setAttribute("value",'<cfoutput>#abbreviation#</cfoutput>');
itemselect.appendChild(theOption);
}
Im trying to creat a dynamic javascript list, populating it using a CF query.
Can anyone tell me how I can loop through the query and set the options of the list?
Here is my code but it doesnt work.
Please help
Thankyou
-------------------------------------
<CFquery name="avequipment" datasource="itsupport" username="#dsn_username#" password="#dsn_password#">
SELECT Equipment FROM JL_av_items ORDER BY Equipment
</cfquery>
//add options to equipment select list
var recordcount = '<cfoutput>#avequipment.recordcount#</cfoutput>';
for(t=1; t<=recordcount; t++)
{
theOption=document.createElement('option');
theText=document.createTextNode('<cfoutput>#equipment#</cfoutput>');
theOption.appendChild(theText);
theOption.setAttribute("value",'<cfoutput>#abbreviation#</cfoutput>');
itemselect.appendChild(theOption);
}