Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
jfojtek #1
Interdependent Drop Down Menus
Hello,
I am curious to know if anyone is willing to share their code - or suggestions
- for a set of 2 interdependent drop down menus of countries and then
states/provinces? I can find some JavaScript help on creating the
interdependent drop down menus statically, but cannot seem to get them to work
when pulling the data from the database tables. Any help would be appreciated.
Thanks in advance.
John
jfojtek Guest
-
Drop down menus using CSS
Can anyone more experienced with Dreamweaver help me get my drop down menu to work in IE? By looking at the website I have been trying to fix,... -
drop down menus
CC: It loads slowly because it is large relative to the target weight for a web page. The only remedy is to not use that method. Here are two... -
Drop-Down Menus?
this might be a silly question, but what is the best way to use DW drop-down menus througout your site for navigation? Is there a way to put the... -
Drop Menus?
Do I need a special software or different program to create in a normal flash page production, a drop menu that (a) drops when scrolled over, (b)... -
Why are drop-down menus so slow?
First and foremost.... it's a very nice looking site. Nice muted colors, plenty of white space, and I like the "About" circle a lot. Not quite sure... -
gwgiswebmaster #2
Re: Interdependent Drop Down Menus
you may need a combination of both. if you're referring to changing one menu
based on anothers selection, then the best approach is to have the onchange
fire a hidden popup which "draws" the contents of the other menu via CFQuery
and Javascript on self.opener properties
gwgiswebmaster Guest
-
jfojtek #3
Re: Interdependent Drop Down Menus
Thanks for the reply.
What I want to do is have the first pull down menu be populated from a
database query from the countries table. The second pull down would be ghosted
until the first has been selected and then be a list of the states or provinces
(or whatever other territory) for the chosen country - also from a database
query with the relationship being the country code from the first selection.
I would like to avoid a popup if possible and just have 2 pull down menus.
Any ideas on how to implement your idea or mine?
jfojtek Guest
-
gwgiswebmaster #4
Re: Interdependent Drop Down Menus
you can try the same approach using a hidden frame as well. if using the pop
up, it would only be open for as long as it took to draw the 2nd menu, but I
can understand your concern, especially with XP SP2 users.
gwgiswebmaster Guest
-
-
david_h #6
Re: Interdependent Drop Down Menus
the other way is to build a .js file via coldfusion and cffile, and download
it to the users machine once...using some sort of cache stamp
..js?cacheStamp=3 that way they only have to download the content once, not each
time they go to that page.
david_h Guest
-
jfojtek #7
Re: Interdependent Drop Down Menus
david_h,
I am not too concerned about the content being too much every time they need
to reload it. This should only be used to set up an account or to change the
account. But you do bring up an interesting topic about storing the content.
Do you think it is worth the effort to download the file to the users maching
knowing that 99% of the users are only going to see this screen once?
If not, would you just do it with JavaScripting and how?
jfojtek Guest
-
bifnaked99 #8
Re: Interdependent Drop Down Menus
Javascript to use on MAIN page:
function changeStates() {
var country = document.forms[0].country.value;
var q = document.getElementById('queryDB');
q.src = 'http://www.YOURSITE.com/state_query.cfm?country_id=' + country;
}
Country List Drop Down Box:
Your DB Query Here
<cfselect required="yes" name="country" style="font-size: 8pt; font-family:
tahoma, arial;" query="countries" value="country_code" display="country name"
multiple="no onChange="changeStates()"">
State/Province Drop Down Box:
<select name="stprov" style="font-size: 8pt; font-family: tahoma, arial;">
</select>
<iframe src="http://www.YOURSITE.com/state_query.cfm?country_id=US" width="0"
height="0" id="queryDB" style="border: 0px;"></iframe>
Code for Iframe Page
YOUR STATE CODE QUERY HERE
<script language="JavaScript" type="text/JavaScript">
f = top.document.forms[0];
for (i=f.stprov.length; i >= 0; i--)
f.stprov = null;
<cfoutput>
f.stprov[$i] = new Option(#stateQuery.state_id#,#stateQuery.state_nam e#);
</cfoutput>
</script>
bifnaked99 Guest



Reply With Quote

