Reputation: 3380
I have a form in Yii, and I want to add a class to the form :
<form class="subscribe_form" action="#" method="post">
I tried this but it's not working :
<?php $form=$this->beginWidget('CActiveForm', array(
'class'=>'subscribe_form',
'id'=>'mail-list-addmail-form',
'enableAjaxValidation'=>false
)); ?>
Thanks for helping me!.
Upvotes: 6
Views: 10726
Reputation: 1349
htmlOptions: additional HTML attributes that should be rendered for the form tag.
htmlOptions: there is commonly through all HTML helpers CHtml
, CActiveForm
and you can set the custom HTML options in this property.
Upvotes: 0
Reputation: 4023
You need to pass an htmlOptions property, like this:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'mail-list-addmail-form',
'enableAjaxValidation'=>false,
'htmlOptions'=>array(
'class'=>'subscribe_form',
)
)); ?>
from http://www.yiiframework.com/doc/api/1.1/CActiveForm#htmlOptions-detail
Upvotes: 7