Highlight Label Error

Given the following markup:


<div class="row terms">

	<?php echo $form->labelEx($model, 'agree_terms', array('for'=>false)); ?>

	

	<div class="option">

		<?php echo $form->checkbox($model, 'agree_terms'); ?>

		<?php echo CHtml::label('I have read and accept the Terms of Use', 'User_agree_terms', array('class'=>'agree-terms')); ?>

	</div>

	

	<?php echo $form->error($model, 'agree_terms'); ?>

</div>



The problem is, in AJAX validation mode, the model label does not get highlighted (the ‘error’ class gets applied to the inner div). However in PHP validation mode it does get highlighted.

FIXED:


<?php echo $form->error($model, 'agree_terms', array('inputContainer'=>'.terms')); ?>

“inputContainer: string, the jQuery selector for the HTML element containing the input field. During the validation process, CActiveForm will set different CSS class for the container element to indicate the state change. If not set, it means the closest ‘div’ element that contains the input field.”