A simple cascading drop down box |
[eluser]wizzer[/eluser]
Greetings, I need to create two drop down boxes, with the choice from the first box determining the choices seen in the second box. Are there any neat CI techniques I can use? If not can anyone point me toward a simple tutorial. I tried one from here but i didnt quite understand it. Javascript is really hard for me. I have tried two tutorials so far but cannot get them to work. Thanks in advance Wizzer
[eluser]jcavard[/eluser]
Well, first you need your two drop down controls Code: <select name="country" id="country"> then add the javascript to handle the selected value Code: $(document).ready(function(){ then the php script you call outputs the value in xml format to insert into the second drop down, just use malsup's taconite, it's really simple Code: <replace select="#states">
[eluser]Jondolar[/eluser]
You may also want to check out some of the more popular ajax libraries (my favorite is jQuery). An ajax library may be overkill for what you are initially trying to do but it may be easier and faster.
[eluser]jcavard[/eluser]
[quote author="Jondolar" date="1249951696"]You may also want to check out some of the more popular ajax libraries (my favorite is jQuery). An ajax library may be overkill for what you are initially trying to do but it may be easier and faster.[/quote] easier. faster. |
Welcome Guest, Not a member yet? Register Sign In |