How to add css classes and id to form fields

How do I go about adding a class or id to a specific form field


<input type="text" id="selectme" class="myclass">

I don’t want it for all inputs just specific ones


How do you create the form field ? check the documentation for that function and you will see that there is htmlOptions attribute that you can use ;)

My question does not ask how to create a form field

it ask how to add a class or id to a specific input field

I was looking at Cactiveform documentation

I’ll see if I can figure it out from the htmlOptions

something like this

<?php echo $form->textField($model,‘confirmEmail’, array (‘class’ => ‘sync’)); ?>

it can go on like this:

<?php echo $form->textField($model,‘confirmEmail’, array (‘class’ => ‘sync’, ‘id’ =>‘fun’ )); ?>

Thanks! exactly what I needed, needed to target fields for jquery addons