![]() |
form_dropdown and javascript - 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: form_dropdown and javascript (/showthread.php?tid=26991) |
form_dropdown and javascript - El Forum - 01-28-2010 [eluser]filip_de_backer[/eluser] hi everyone, I've got the following code: // $clubs is an array echo form_dropdown('ddlClubs', $clubs); when I want to het the selected value with javascript I have an error (object is null) var e = document.getElementById("ddlClubs"); When I change the form_dropdown to the html <input> tag, it works fine. What have I forgotten in the code? The form_dropdown is server code and the javascript is client code so normally the dropdown should be accessible. thanks Filip form_dropdown and javascript - El Forum - 01-28-2010 [eluser]Kamarg[/eluser] The first parameter sets the name of the dropdown not the id. Code: echo form_dropdown('ddlClubs', $clubs, 0, 'id="ddlClubs"'); form_dropdown and javascript - El Forum - 01-29-2010 [eluser]filip_de_backer[/eluser] thanks! problem solved! |