1. Christoffer Niska
  2. yii-bootstrap
  3. Issues
Issue #225 new

Is not possible to set attribute specific enableAjaxValidation or enableClientValidation

created an issue

I'm trying to do this in the yii bootstrap way:

            <?php echo $form->textField($model,$attribute); ?> 
            <?php echo $form->error($model,$attribute,array(),false,true); ?>

But looking at the code of TbActiveForm and TbInput, TbInputVertical i cannot find a way to pass that two options with the errorOptions.

            <?php echo $form->textFieldRow($participant,"[$index]nom",array(
                'enableAjaxValidation'=>false))); ?>

In TbInput getError it calls:

protected function getError()
    return $this->form->error($this->model, $this->attribute, $this->errorOptions);

But the last two paramaters cannot be set even with errorOptions.

I fix it temporally adding that on TbActiveForm error after the global form enableClientValidation and enableAjaxValidation

            if (isset($htmlOptions['enableAjaxValidation']))
                    $enableAjaxValidation = $enableAjaxValidation ? $htmlOptions['enableAjaxValidation'] : false;

            if (isset($htmlOptions['enableClientValidation']))
                    $enableClientValidation = $enableClientValidation ? $htmlOptions['enableClientValidation'] : false;

Comments (0)

  1. Log in to comment