how to set the id attribute for CHtml::activeTextField

Hi All

I want to set the id attribute on a texfield. Currently I create the textfield as follows:


<?php echo CHtml::activeTextField($model,'email') ?>

What do I have to add to set an id ?

thnx a lot

Luca

if it is an activeTextField, the id is set according to ModelName_AttributeID. Please see CHtml::resolveNameID code to see it… If you wish to change that default feature, you just set the id on the HtmlOptions parameter array of the activeTextField function. ie: array(‘id’=>‘MI_id’);

BTW: why would you like to change the id of your activeTextField?

Cheers

good point, I missed the default ID. And I just noticed that


<?php echo CHtml::activeTextField($model,'email', array('id'=>'foo')) ?>

does work :)

cheers