Html::activeInput and Html::error like activeField after validation


I have an Active form:

<?php $form = ActiveForm::begin([

    'fieldConfig' => [

	'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{endWrapper}\n{error}",


    'enableClientValidation' => false


]); ?>

(enableClientValidation is false because some inputs are loaded in ajax and the clientValidation not match this)

The most of inputs are ActiveField like

<?= $form->field($trip, 'price', [...] ?>

and others loaded through ajax

<?=Html::activeTextInput($model, 'attribute', [])?>

<?=Html::error($model, 'attribute')?>

With ActiveField the label, the input and error message is highlighet in red after validation thanks to the class "has-error" added by some javascript (which one?) to wrapper:

<div class="form-group field-trip-price has-error">

How can I achieve the same result with the second type of input field?

In alternative there is a way to pass $form through an ajax request? :-X

Thank you


<div class="form-group field-trippoint-0-from <?php if($model->getErrors('attribute')) echo "has-error" ?>">

<?=Html::activeTextInput($model, 'attribute', [])?>

<?=Html::error($model, 'attribute')?>


very simple I’ve add <?php if($model->getErrors(‘attribute’)) echo “has-error” ?> in the view loaded in ajax