![]() |
Dropdown onchange - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Dropdown onchange (/showthread.php?tid=35515) |
Dropdown onchange - El Forum - 11-01-2010 [eluser]Funky Fresh[/eluser] Hey All, Im having a few problems with some code im working on. Basically, i have got a dropdown which is populated by values from the database, in my view i am displaying it like so. Code: <?php echo form_dropdown('roles', $roles, set_value('roles', $roles)); ?> Below that i have 2 textboxes, just standard <input type="text" /> thingos. What i want to do, is populate the textboxes with values from the database based on what the user clicks on the dropdown box. I have had a look around the forums, and seem some examples of populating another dropdown, but not textboxes, ive tried to make my own solution, but i cant seem to get it going. Could someone give me a hand, maybe some yummy source code would help. Thanks guys Dropdown onchange - El Forum - 11-01-2010 [eluser]umefarooq[/eluser] you can populate textbox with ajax onchange event of dropdown send a request to server and get the values and populate the textbox if you are using jquery then your code will be like this if you are getting json data from server Code: $("#dropdown_id").change(function(){ |