php - How to assign disabled attribute to dropdown menu in codeigniter? -
i using form helper codeigniter create dropdown menu. have looked @ http://codeigniter.com/user_guide/helpers/form_helper.html doesn't specify how assign attributes drop-down menu items. want disabled option first one.
as stands im using:
<?php $countries = array( 'ca' => 'canada', 'mx' => 'mexico', 'us' => 'united states' ); ?> <?php echo form_dropdown('country',$countries,$user->countrycode,'class="form-control"'); ?> how can add first option says choose country disabled user cant pick once open dropdown? know add blank 1 list pick-able option.
thanks help!
codeigniter doesn't support via form helper. i'd hardcode form if needed kind of thing.
there small hack / bug exists can use want. try countries array:
$countries = array( '--" disabled="disabled' => '** please select country **', 'ca' => 'canada', 'mx' => 'mexico', 'us' => 'united states' ); then feed array form helper have done , see if works.
Comments
Post a Comment