![]() |
form_dropdown helper --> disabled option - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: form_dropdown helper --> disabled option (/showthread.php?tid=64367) |
form_dropdown helper --> disabled option - Islam Sharaf - 02-13-2016 Hello, I can't mark specific options as disabled because no way to do it. Code: <option value="1" disabled> ddddd</option> I tried to add it in options array by add the disabled attribute beside the value eg. : PHP Code: $options = array( 'small" disabled' => ''small shirt"); Also i tried : PHP Code: $options = array( 'small" disabled = "disabled' => ''small shirt"); But the problem with html_entities it converts the double quote to the entity : "e form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) I'm looking forward to something like that: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '', $disabled_options = array()]]]]]) If there is an extra option called $disabled_options = array() it would be great. RE: form_dropdown helper --> disabled option - Wouter60 - 02-13-2016 You can create your own MY_form_helper.php. Put your form_dropdown() function inside this php file. It will override the standard form_dropdown() function. RE: form_dropdown helper --> disabled option - moh.elogail - 08-27-2017 Create custom dropdown function inside the application/helpers/MY_helper.php, and autoload your new helper. PHP Code: function my_form_dropdown($data = '', $options = array(), $selected = array(), $disabled = array(), $hidden= array(), $extra = '') It is the same as the core form_dropdown() function but with two new arguments ([array] disabled) , ([array] hidden): Usage: PHP Code: $data = ['name' => 'countries', class='form-control']; |