Placeholder for form elements

with the last release of Firefox 4 out of 5 of the major browser support this html feature.

can we have full support in yii too?

the ideal implementation would be to have a new method inside models to set the placeholder (just like we do now for labels) and when the form element is created it looks into the model to fill the placeholder attribute.

Just looked into this. You can currently do this for your text field:




<?php echo $form->textField($model,'attribute',array('size'=>60,'maxlength'=>255,'encode'=>false,'value'=>'','placeholder'=>'Placeholder content')); ?>



Which is pretty slick.

yeah i know… but it’s not really good when you have to do it N times across the application… i was hoping, since its becoming a standard, to have it better integrated o.o

Just wondering what you mean by integrated? As in can be created say via a DB?

In place holder maybe there are some tips, suggestions, rule details etc. You have to hold them some where like db or make them from something.

That’s a good idea, if it made up of rules() in model class.

Thanks man :)