Tooltips & error reporting

This is a weak part of Yii ( imho ).


Every model has an attributeLabels() function to generate customized a input field label.

I think that Yii need a inputTooltips() function to generate a customazed tooltip for each input field that we have.

Like many people know we have a good library that use jQuery that has many features ( included tooltips ): http://flowplayer.or…oltip/form.html

Error reporting

At this moment we can use CHtml::errorSummary($model); to print the summary of errors for this model.

I think that a better way is to put a permanent red tooltip near the the field that has an error to make the error message related the input field cleaner than now.

Another way is to put an error icon right near the input field and onOver show the tooltip with the error message related to that field.

What do you think about? I know that Yii want to leave the core code small but I think that these are some must-have-point for a good framework. Maybe I will do some extensions for this but before I want to know your opinions.

This can be implemented by extending CActiveRecord to provide such a method. And then all your other AR classes extend from this base class.

The reason that we don't want to include this into the core is because there could be other similar requests that would bloat the CActiveRecord class eventually.

Also, the tooltips are more suitable to be classified as presentational elements, which do not belong to model (label is special because we need it everywhere to name an attribute).

Why have I to extend CActiveRecord ? ( i mean, why CActiveRecord )

Sorry for misunderstanding. Did you try using CHtml::error()?

I agree, inputTooltips() is too application-specific.  You may extend Yii yourself to allow for this functionality (as qiang said, I would extend CActiveRecord, and also CHtml)

hi friends you can use tooltip in your form like

echo $form->textFieldRow($model,‘email’,array(‘rel’=>“tooltip”, ‘title’=>‘if you are employer than please enter your company email’));

if you are using booster.