Skip to main content

Posts

Showing posts from July, 2014

yii add a hidden field in form

in views hidden field  with  model and form: <? php echo $form -> hiddenField ( $model , 'name' ); ?> with  value: <? php echo $form -> hiddenField ( $model , 'name', array('value'=>$value) ); ?> or  without  model <? php echo CHtml :: hiddenField ( 'name' , 'value' , array ( 'id' => 'hiddenInput' )); ?>

YII CGridView add a custom button like edit,delete,import etc

Add a custom button to YII CGridView like update,delete buttons You can use template property to change order of build-in buttons or add/remove new buttons like this: array ( ' class ' => ' CButtonColumn ' , ' template ' => ' {delete}{update} ' , ) In CGridView's buttons column build upon above example there will be no view button and delete and update buttons will be in other than default order (delete first). You can use the same property to introduce new buttons: array ( ' class ' => ' CButtonColumn ' , ' template ' => ' {up}{down}{delete} ' , ) For new buttons (and of course - for existing, build-in ones too!) you have to specify look and behaviour. buttons  property of CButtonColumn is used for it. This property is an array of buttons id (which names must correspond to the one provided in  template  property) and each button is another array holding its specific