client side validation

I have a variable which is not a field variable in table. I declare it in model. But validation is not happening on the client, though I am using core validator.





class Breakdown extends \yii\db\ActiveRecord

{

    public $enos_id;

   


    /**

 	* @inheritdoc

 	*/

    public static function tableName()

    {

        return 'breakdown';

    }


    /**

 	* @inheritdoc

 	*/

    public function rules()

    {

        return [

            [['enos_id'], 'integer', 'min' => 1, 'max'=>99, ],

            .........

        ];

    }


    /**

 	* @inheritdoc

 	*/

    public function attributeLabels()

    {

        ....

    }

}




enos_id is the variable which is getting input from the form but I am unable to get it validated on client side.

It can`t be. Check better.

Show us form field please.

The excerpts from view file is here:





<?php $form = ActiveForm::begin(); ?> 

<div class="row">

    .....

        <?= $form->field($model,'enos_id')  ?>

.......

    </div>

</div>

<div class="form-group">

    <?= Html::submitButton('Create' , ['class' => 'btn btn-success']) ?>

</div>



I’ve reproduced your code in my project and it works