How to add class to Form in Yii framework?
10,483
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
Related videos on Youtube
Author by
deltascience
Updated on May 25, 2022Comments
-
deltascience almost 2 years
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!.