ColdFusion Programming/a pair of dynamic cfselect
Expert: Srini - 4/24/2008
QuestionQUESTION: good day sir, can i ask a question:
I know that cf is a server side programming, but i need a two dynamic cfselect that respond to each other without sending the page sending to the server.
for example i have three category on my cfselect1:
1. Animals
2. Plants
3. Planets
If i select Animals on my cfselect1 i want my cfselect2 to load all animals from my MSaccess table, and same with the other categories (animals, plants, planets).
Is it possible? Please help.
thank you very much and im looking forward for this.
ANSWER: Hi,
You can't do the dynamic drop down unless you use sending to server OR using Javascript.
If you use javascript you can populate the both dropdown from coldfusion and change dynamically
here is the sample which tells you step by step how you can do it.
http://www.plus2net.com/javascript_tutorial/dropdown-list.php
Happy programming!!
-Srini
---------- FOLLOW-UP ----------
QUESTION: sir, i just want to ask how can i use javascript variable to coldfusion. thank you very much in advance.
AnswerHi
you can't access javascript (client) variable in coldfusion (server).
If you want to pass javascript variable to coldfusion, use hidden input variable and pass thru that.
something like this
<input type=hidden id="hidtext">
javascript
<script>
document.getelementbyid("hidtext").value = javasvcriptvariable
</script>
happy programming!!
-Srini