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

Inline BootActiveForm :: clientOptions not working

Anonymous created an issue


I'm trying to call an 'afterValidate' function with your Bootstrap Form. I set it inside de clientOptions array of the 'BootActiveForm'. If I use 'type'=>'horizontal' it works great, but If I change it to 'type'=>'inline', the JavaScript function is not set.

Could you check if is there anything wrong with the inline form and the 'afterValidate' option of the property clientOptions?

This is my form:

$form=$this->beginWidget('bootstrap.widgets.BootActiveForm', array( 'id'=>'clientContact-form', 'type'=>'inline', 'htmlOptions'=>array('class'=>'well'), 'action' => $actionUrl, 'enableClientValidation'=>true, 'focus'=>array($model,'name'), 'errorMessageCssClass' => 'input-notification-error error-simple png_bg', 'clientOptions'=>array('validateOnSubmit'=>true, 'validateOnType'=>false, 'errorCssClass' => 'err', 'successCssClass' => 'suc', 'afterValidate' => 'js:function(form,data,hasError){ $.js_afterValidate(form,data,hasError); }', 'errorCssClass' => 'err', 'successCssClass' => 'suc', 'afterValidateAttribute' => 'js:function(form, attribute, data, hasError){ $.js_afterValidateAttribute(form, attribute, data, hasError); }' ), ));


<p class="note">Fields with <span class="required">*</span> are required.</p>

<?php echo $form->errorSummary($model); ?>

<input type="hidden" name="ClientContact[client_id]" value="<?php echo $client_id; ?>">
<?php echo $form->textFieldRow($model, 'name', array('class'=>'input-small','maxlength'=>64)); ?>
<?php echo $form->textFieldRow($model, 'surname', array('class'=>'input-small','maxlength'=>64)); ?>
<?php echo $form->textFieldRow($model, 'phone', array('class'=>'input-small','maxlength'=>9)); ?>

<input type="hidden" name="YII_CSRF_TOKEN" value="<?php echo Yii::app()->request->csrfToken; ?>"/>

<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'type'=>'primary', 'icon'=>'icon-ok icon-white', 'label'=>'Guardar')); ?>

<?php $this->endWidget(); ?>

Comments (1)

  1. Log in to comment