Multiple functions with form_dropdown for some che

2019-08-19 04:16发布

问题:

I want to apply some functions to multiple checked checkboxes using form_dropdown in Codeigniter. I want to have delete, activate and deactivate functions for some selected data. How can I write this code in Codeigniter. Can somebody help me ?!

回答1:

You could define some JavaScript functions that you then attach to each of your dropdowns. This isn't the exact code, http://codeigniter.com/forums/viewthread/165476/#792072 but it illustrates how you can pass a fourth parameter to form_dropdown, which would let you add an onChange attribute that could execute a function.

form_dropdown('field_name', $options, $selected, 'onchange="doSomething(this)"');

Alternatively, you could use JavaScript to bound the action to the drop downs on load. Either way, you should be able to give each drop down a different action this way.