Custom Id For Form Fields

Hi,

I would like to be able to assign a custom id for a checkbox form field.

I’m using bootstrap and bootstrap booster.


<?php echo $form->checkBoxListInlineRow($data, 'xx_enabled', array('xx name'), array('class'=>'xx-clas', 'labelCss'=>'dd-show' )); ?>

Any help would be appreciated.

Paul.

Does this not work?




<?php echo $form->checkBoxListInlineRow($data, 'xx_enabled', array('xx name'),

        array('class'=>'xx-clas', 'labelCss'=>'dd-show', 'id'=>'your-id')); ?>



unfortunately not.

define your custom Id in respected model and get it here like other attributes of Model as for bootstrap you need both $model and attribute

something like

in your model inside class

public $custom_id;

public function rules() {

    // NOTE: you should only define rules for those attributes that


    // will receive user inputs.


    return array(

array(‘custom_id’, ‘safe’),

);

}

in view

<?php echo $form->checkBoxListInlineRow($data, ‘custom_id’, array(’’), array(‘class’=>‘xx-clas’, ‘labelCss’=>‘dd-show’ )); ?>

Enjoy :D