1. Christoffer Niska
  2. yii-bootstrap
  3. Issues
Issue #40 resolved

Required/Error filed color

Anonymous created an issue

Imagine to put CJuiDatePicker or CMaskedTextField in horizontal BootActiveForm. You need to write that code



<div class="control-group"> <?php echo $form->labelEx($model,'date',array('class'=>'control-label')); ?> <div class="controls"> <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array( 'model'=>$model, 'attribute'=>'date', 'language'=>'it', 'htmlOptions'=>array( 'class'=>'input-small' ) )); ?> <?php echo $form->error($model,'date'); ?> </div> </div> }}}

in case of error label, field and error message will not became red.

I suggest to add to yii-bootstrap.css

label.error, span.error { color: #b94a48; }

input.error, select.error, textarea.error { color: #b94a48; border-color: #b94a48; }

and modify BootActiveForm init function to:



public function init() { if (!isset($this->htmlOptions['class'])) $this->htmlOptions['class'] = 'form-'.$this->type; else $this->htmlOptions['class'] .= ' form-'.$this->type;

    if ($this->inlineErrors)
        $this->errorMessageCssClass = 'help-inline '.CHtml::$errorCss;
        $this->errorMessageCssClass = 'help-block '.CHtml::$errorCss;



Comments (1)

  1. Log in to comment