Required Field "*" Placement


Can some one tell me how to place "*" sign before the label

Please refer the image if i am not clear.

This is the code that gives "*" after label "Password"

        <div class="row">

		<?php echo $form->labelEx($model,'password'); ?>

		<?php echo $form->passwordField($model,'password'); ?>

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


make needed field required

You can optionally set $htmlOptions[‘required’] = true for activeLabel (activeLabelEx will overwrite it).

this is what you need


CHtml::$beforeRequiredLabel = ' <span class="required">*</span>';

CHtml::$afterRequiredLabel = '';