YII Client side form validation error doesn’t prevent form submit

YII Client side form validation error doesn’t prevent form submit To get this behavior you just need to add ‘clientOptions’ => array(‘validateOnSubmit’=>true), to your configuration so it would look like this: $form=$this->beginWidget( ‘CActiveForm’, array( ‘id’=>’member-form’, ‘enableAjaxValidation’=>false, ‘enableClientValidation’=>true, ‘clientOptions’ => array(‘validateOnSubmit’=>true), ));

YII cgridview Tricks

Yii cgridview make custom drop down filters, Yii cgridview set row color based on a condition, Yii cgridview add time picker in filter, Yii cgridview add drop down in colum values Here is an example how you can make custom drop down filters in YII cgridview: $this->widget(‘zii.widgets.grid.CGridView’, array( ‘id’ => ‘card-applications-grid’, ‘dataProvider’ => $model->search(), ‘filter’ =>… Continue reading YII cgridview Tricks

PHP YII Change the Row Color Based on the Column value in CGridView [rowCssClassExpression]

Belows is how you can use CGridView ‘rowCssClassExpression’ to change row color based on a column’s value: $this->widget(‘zii.widgets.grid.CGridView’, array( ‘dataProvider’=>$dataProvider, ‘rowCssClassExpression’=>'($data->column_name==0)?”new”:”old”‘, ‘columns’=>array( … ),)); You can also call a custom php function, and pass the $data variable to it. That function should return the class name for the given row 🙂