![]() |
form_radio() and form_dropdown() .. array data . how to ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: form_radio() and form_dropdown() .. array data . how to ? (/showthread.php?tid=22631) |
form_radio() and form_dropdown() .. array data . how to ? - El Forum - 09-16-2009 [eluser]Nano HE[/eluser] Hi, Good day. I am newbie. i got two quesions about form_radio() and form_dropdown() Q1, How to rewrite the following snatch code with form_radio. Code: echo "<p><label for='gender'>Gender</label><br/>"; Q2, How to get 2nd form_dropdown $options categoried based on the 1st form_radio selected. that means. 1st. if i selected (form_radio) item "Male" 2nd. i could select the (form_dropdown) list items which only related with Male. (Male 20-29, Male30-39, etc.) 3rd. and the other Female related items will hide, not show on the dropdown list. 4th. conversely when i selected (form_radio) item "Female". Only show (Female20-29, etc.) ===================================== Comment: Q1 soluted. thanks form_radio() and form_dropdown() .. array data . how to ? - El Forum - 09-22-2009 [eluser]Nano HE[/eluser] Revised. My CI race registration form. http://www.ironmanchina.net/active/index.php/form/ When user selected the gender, such as "Male". How to only show the Male related the race groups at the below "Race Category Select" form_dropdown() list. Anybody could give me a hand? Any help will be appreciated. :-) form_radio() and form_dropdown() .. array data . how to ? - El Forum - 09-22-2009 [eluser]rogierb[/eluser] jquery:-) <code> $("input[name=gender]").change(function(){ $("select[name=category] option[gender!="+$(this).val+"]").hide(); $("select[name=category] option[gender="+$(this).val+"]").show(); }) </code> 1: Add a gender attribute to the select options 2: Just hide the options (wrong gender) on change of gender and show the ones with the right gender 3: IE can be a bit buggy when referencing to the options in a select |