Copy link to clipboard
Copied
I’m using Coldfusion 9,0,0,251028 on Windows 7 64-bit, with a Microsoft Access 97 database.
I’m having a problem with using a drop-down menu to create another one below it once a certain option is selected
(in this case, the option named “Breaking News”, which has an id of 31).
What event trigger should I use to create a drop-down menu underneath the first one when “Breaking News” is selected?
Should I be using Javascript for something like this, or can Coldfusion handle it?
Here’s the code:
<cfquery name="get_info" datasource="#db#">
select * from lists
order by department asc, list asc
</cfquery>
<div align="left">
<select name="list">
<option value="-1" selected> --------------------------------------
<cfoutput query="get_info" group="department">
<cfoutput group="list">
<cfif list neq "Breaking News Cell Phone">
<option value="#id#">#list#
</cfif>
</cfoutput>
<option value="-1"> --------------------------------------
</cfoutput>
</select>
</div>
Copy link to clipboard
Copied
If it were me, I'd use javascript. The event would be the onChange of the first drop down.
Depending on the details, I might use ColdFusion to create the content of the second drop down.
Copy link to clipboard
Copied
Depending on the details, I might use ColdFusion to create the content of the second drop down.
The second drop-down is supposed to be an expiration date that gets attached to the message so it can be self-removing.
The first drop-down is to specify a category for a message to be sent out on.
In this case, the only one that needs the secondary expiration drop-down is a single category (Breaking News),
so all other options on the drop-down would have to not trigger the expiration date drop-down showing.
In that situation, would you use ColdFusion to create the second drop down?
Copy link to clipboard
Copied
The circumstances under which I would use use Cold Fusion to create the second drop down include:
involves data selected from a database
or
has a lot of elements.
or
many other things I can't currently think of.
The technique is:
Use create the dropdown inside cfsavecontent tags.
Use either cfwddx or toScript() to convert the html to json.
While I've not done it with a drop down, I have done it with a series of checkboxes.
Copy link to clipboard
Copied
Solved by using function:
checkBreak()
{var theMenu=document.getElementById("exp_select").style;
if (document.asdf.list.selectedIndex == 1)
{theMenu.visibility="visible" }
else
{theMenu.visibility="hidden" }
}
and setting the drop-down menu in css as
#exp_select
{
visibility: hidden;
}
Thank you for the help, Dan.