I have a textfield which is required under some circumstances but not always. I would like to use the yii error checking on the field. However, making it required in the model means it will always be required. Is it possible to somehow just make it required in a single view?
<?php echo CHtml::label('Instructions', 'comment'); ?> <?php echo $form->textField($tsession,'comment',array('size'=>45,'maxlength'=>300)); ?> <?php echo $form->error($tsession,'comment'); ?>
I would like to do something like add an option ‘required’=>true but that isn’t working. Is there a way to do this?