CHtml::textField() always adds an "id" attribute

Most CHtml helper methods, including textField(), produce an HTML "id" attribute :

foreach (array('tagA', 'tagB', 'tagC') as $tag) {

    echo CHtml::textField('tags[]', $tag);


will become:

<input id="tags" type="text" value="tagA" name="tags[]" />

<input id="tags" type="text" value="tagB" name="tags[]" />

<input id="tags" type="text" value="tagC" name="tags[]" />

This is invalid HTML. Is there a way to avoid theses ids ? I tried to add a third parameter “array(‘id’ => ‘’)” or “array(‘id’ => null)”, and it didn’t work, so I may open a bug ticket for this.

I know I could add a counter and give a numbered id to each input, but that would be a pain. And it would make cloning with JS uglier (I would have to remove or increase the id attribute with jQuery).

It should be array(‘id’=>false)

Thanks, I forgot to try this one!