Tpaul_10
asked on
Building or creating dynamic drop down
Experts,
I need to build a dynamic dropdown list based on the selection of a other dropdown. Also I don't want to submit
the form since I have other data entry field on my form and don't want to lose the user entered data.
What is the best way to achive it using CF and/or Java Script. An example would really help to save the time since it is kind of urgent.
My first query is : select state from mydatabse.states
My second query is : select counties from mydatabase.counties where state = #state#
Thanks in Advance
I need to build a dynamic dropdown list based on the selection of a other dropdown. Also I don't want to submit
the form since I have other data entry field on my form and don't want to lose the user entered data.
What is the best way to achive it using CF and/or Java Script. An example would really help to save the time since it is kind of urgent.
My first query is : select state from mydatabse.states
My second query is : select counties from mydatabase.counties where state = #state#
Thanks in Advance
ASKER
Thanks for the quick reply and example srikanthmadishetti:
Right now I am not using or don't want to use the CFC. So, can I just use the fuction in that example and build my second drop down in the same page? with regular HTML instead of CFSELCT etc.?
Right now I am not using or don't want to use the CFC. So, can I just use the fuction in that example and build my second drop down in the same page? with regular HTML instead of CFSELCT etc.?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@brijesh Good to see you in EE :)
@Tpaul
>>>Right now I am not using or don't want to use the CFC. So, can I just use the fuction in that example and build my second drop down in the same page? with regular HTML instead of CFSELCT etc.?
Is there any specific reason for not using the cfselect or cfc
First it will be just few lines of code and second cfc will help you to reuse this code any where .
You can use it any form which has the state and country drop downs .
@Tpaul
>>>Right now I am not using or don't want to use the CFC. So, can I just use the fuction in that example and build my second drop down in the same page? with regular HTML instead of CFSELCT etc.?
Is there any specific reason for not using the cfselect or cfc
First it will be just few lines of code and second cfc will help you to reuse this code any where .
You can use it any form which has the state and country drop downs .
Hi Wanna Spend some Bucks! there are good dependent dropdownds in cftagstore!
here is ur search:
http://www.cftagstore.com/tags/related.cfm
http://www.cftagstore.com/tags/cfrelatedselectscontrol.cfm
http://www.cftagstore.com/tags/relatedselectmenuformcontrolcalculator.cfm
here is ur search:
http://www.cftagstore.com/tags/related.cfm
http://www.cftagstore.com/tags/cfrelatedselectscontrol.cfm
http://www.cftagstore.com/tags/relatedselectmenuformcontrolcalculator.cfm
ASKER
I have old cold fusion code and the site is going away soon. So, no CFCs and don't want to spend money for buying the code -:(
I may look in to writing a custom tag, but need to find out if the tables are related to have one query.
May be an example would be helpful.
I may look in to writing a custom tag, but need to find out if the tables are related to have one query.
May be an example would be helpful.
I provided you with a custom tag: cf_twoselectsrelated
http://projects.nateweiss.com/nwdc/workcode.htm
> but need to find out if the tables are related to have one query
The would have to be related, wouldn't they? Otherwise, you don't need two related select tags, you could just do two distinctly seperate tags, right?
http://projects.nateweiss.com/nwdc/workcode.htm
> but need to find out if the tables are related to have one query
The would have to be related, wouldn't they? Otherwise, you don't need two related select tags, you could just do two distinctly seperate tags, right?
ASKER
Sorry about the delay and Thanks for all your inputs.
I was able to created a custom tag successfully with the exaple provided by gdemaria. THANKS.
now the problem is , if I go bak and edit my order, I should be able to pre-select the options which I have selected originally like following.
<option value="#myvalue#" <cfif #ListFind(preselectedValue ,query2.va lue1)#> #SELECTED</cfif>>#myvalue# </option>
I am going to try it by adding another parameters to my customtag and use the similar condition like above. But if you have a better solution, please update me.
Thanks
I was able to created a custom tag successfully with the exaple provided by gdemaria. THANKS.
now the problem is , if I go bak and edit my order, I should be able to pre-select the options which I have selected originally like following.
<option value="#myvalue#" <cfif #ListFind(preselectedValue
I am going to try it by adding another parameters to my customtag and use the similar condition like above. But if you have a better solution, please update me.
Thanks
the custom tag has two parameters selected1 and selected2 representing the current values of the two select tags
ASKER
THANKS gdemaria.
Based on my requirements, your answer gave me the complete solution eventhough others have provided with different soluctions
Based on my requirements, your answer gave me the complete solution eventhough others have provided with different soluctions
https://www.experts-exchange.com/questions/24560682/ColdFusion-Ajax-Related-Selects.html