Can anyone point me in the write direction to dynamically set the selected attribute. I am hitting a database and want the value to default to what is the value on the record. The select field is dynamically generated from the following code...
function setOptions(chosen)
{
var selbox = document.frmUpdateRecord.subapplication;
selbox.options.length = 0;
if (chosen == " ")
{
selbox.options[selbox.options.length] = new Option('Please select one of the Applications above first',' ');
}
if (chosen == "Inventory Control & Management Applications")
{
<cfloop query="rsInventorysubapp">
selbox.options[selbox.options.length] = new Option('<cfoutput>#subapplication#</cfoutput>','<cfoutput>#subapplication#</cfoutput>');
</cfloop>
}
if (chosen == "Point-of-Sale & Ordering Applications")
{
<cfloop query="rspossubapp">
selbox.options[selbox.options.length] = new Option('<cfoutput>#subapplication#</cfoutput>','<cfoutput>#subapplication#</cfoutput>');
</cfloop>
}
The above is a sample of the code. Thought it might be too long to post. Basically, I am coding using
js and cf. I want to dynamically in my
js if statement set the selected attribute to what the record says. I can get the info from the db using cf. My problem is that I am unclear as to the syntax to tell it to set it to that value. Something like...
selbox.options.selected = #mycfvalue#
Let me know your thoughts.
Clay Hess