Often you want to give the user info about inputfields, you never no when the user want the information so i want to give the user information via the title attribute on every label.
One way to this is like:
<?php echo $form->labelEx($model,'extra',array('title'=>'Info to user...')); ?>
But then you have to write it all over for each label. I would to have the titel attribute like attributeLabels in model. Or even better, have default htmlOptions per column, like:
public function htmlOptions()
'id' => array('title'=>''),
'extra' => array('title'=>'In this field...'),
Its possibel to build this logik in the framework but i dont want to change the framworks files.
yes possible you can create it as a model’s method or separate component. the decision is depending upon u
model’s method? widthout changing in the framwork? how?
write some method in the model like as you posted in the previous post and call that method in your view like this
But the ide is to make no call. The title should be shown even if i dont write any title, or any htmlOptions.
My idea is to extend the form class, eg. CActiveForm, extend this class and override the label and labelEx methods:
class ActiveForm extends CActiveForm
public function label($model,$attribute,$htmlOptions=array())
if (method_exists($model, 'attributeHtmlOptions'))
$arrHtmlOptions = $model->attributeHtmlOptions();
$htmlOptions = $arrHtmlOptions[$attribute];
Then you can write attributeHtmlOptions method in your model like you said in your first post, and in the view you use ActiveForm widget instead of CActiveForm.