How to hidden a textField

I try to hidden a textField in Yii i use a standard html format and dont work:


<?php echo $form->textField($model,'codDepartamento',array('type'=>"hidden",'size'=>2,'maxlength'=>2)); ?>

what is the correct method?

I autoresponse:

The correct metod are use a "hiddenField" input.


<?php echo $form->hiddenField($model,'codDepartamento',array('type'=>"hidden",'size'=>2,'maxlength'=>2)); ?>

this code work fine!!!

thanks for sharing, just a little note…

i think that the following is unecessary, once the attribute is not visible and hiddenField method takes care of the "hidden" property automatically:




....array('type'=>"hidden",'size'=>2,'maxlength'=>2)...



regards!

Thanks for help:)

Thanks! exactly what i was looking for. It was kind of weird when ‘type’ => ‘hidden’ did not work with $form->textField();

Cheers