How do auto-hints work?

I just saw this new feature https://github.com/yiisoft/yii2/issues/1468. I tried it but could not activate those auto-hints.

Does is work with


ActiveForm::begin(['fieldConfig' => ['autoHint' => true]);

?

It doesn’t seem so…

Hi!

What exactly do you mean?

Your link leads to a 404.

Regards

im also facing the same issue

im getting below error.

i have update the composer too.


Unknown Property – yii\base\UnknownPropertyException

Setting unknown property: kartik\form\ActiveField::autoHint

Sorry, the dot was part of the link. Correct link: https://github.com/yiisoft/yii2/issues/1468 .

Yeah, I also get that exception. Could it be that something has been forgotten?

is this feature released ?

According to this, yes: https://github.com/yiisoft/yii2/blob/master/framework/CHANGELOG.md#204-may-10-2015

Hopefull does not mean: Specifiying yes, using no… :D

Do you have attributeHints() method in your model?

Now it’s working for me! I guess my problem was that I passed an unneeded configuration to ActiveForm. Obviously, I did not try without it.

Conclusion:

Just implement (overwrite) attributeHints in model. That’s it. No activation required.




    public function attributeHints() {

        return ['name' => "My hint for the model attribute 'name'."];

    }



And if hints are declared and one wants to hide it though just call


<?= $form->field($model, 'name')->textInput()->hint(false) ?>

or to supply a different string


<?= $form->field($model, 'name')->textInput()->hint('different string') ?>

Please correct me if anything is not correct here.