Input Field Hint Usage

Could someone provide an example how an input field’s hint should look like and work? I added this property to a textField, it is rendered in HTML, but I don’t see any value.

Thanks in advance.

You can use hint like this

<div class="row">

		<?php echo $form->labelEx($model,'password'); ?>

		<?php echo $form->passwordField($model,'password'); ?>

		<?php echo $form->error($model,'password'); ?>

		<p class="hint">

			Hint: You may login with <tt>demo/demo</tt> or <tt>admin/admin</tt>.



Hi stan

How did you use this property ?

until now

I used the class like that <p class="hint">…</p> or by adding the class hint in input Yii HTML element

I didn’t find any info about what should be placed into the property. So, I added some text to it, like this:

echo $form->textField($model, 'property', array('size' => 20, 'maxlength' => 20, 'disabled' => true, 'hint' => 'blablabla'));

and wanted to see what will happen. But nothing changed. From your words, I understand that I need to add an html element with the class ‘blablabla’ :wink: to make it work somehow, but I still have no idea what this working is supposed to be.

You can use placeholder

 <?php echo $form->textField($model,'consulting_sub_mode',array('size'=>60,'maxlength'=>100,'placeholder'=>'Please enter')); ?>