yii - Yii2 attributeLabels - wrap part of the label in a tag -


inside user model, using attributelabels method create text field:

public function attributelabels()     {         return [             'terms'            => 'i accept terms , coditions'         ];     } 

and in view using standard $form->field method show input field:

<?php $form->field($model, 'terms')->checkbox() ?> 

i need wrap terms , coditions inside tag link. how can this?

the checkbox() method takes options array can override default label:

$form->field($model, 'terms')->checkbox([     'label' => 'i accept <a href="/tos.html" target="_blank">terms , conditions</a>' ]); 

detailed checkbox options in api documentation @ http://www.yiiframework.com/doc-2.0/yii-widgets-activefield.html#checkbox()-detail


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -