Hi all,
I am just starting with Yii ;-). In my current (and very first) project, I am using the select2 extension, which is very nice by the way. My problem is that I don’t know how to make the conventional success/fail css styles apply after the form validation process. In my case, I added a “required” rule for the select list field in my form…so, in the case of submitting the form with the list empty, I would like the select list background color to change to red (as it happens with the text fields for example). By default, what I am getting is the select list css unchanged (so…the user has not a clear indication of which field was incorrectly filled). FYI, I am using the select2 widget as explained in the documentation:
<?php
$this->widget('ext.select2.ESelect2',array(
'model'=>$model,
//'attribute'=>'station_ids',
'attribute'=>'stations',
'data'=>CHtml::listData(Station::model()->findAll(), 'ID', 'NAME'),
'options'=>array(
'width'=>'resolve',
),
'htmlOptions'=>array(
'multiple'=>'multiple',
'placeholder'=>'Select stations...',
),
));
?>