What is the problem? together

Insufficient funds in the account!

he leads

The value of "Amount" should not exceed 70.

public function rules() { return [ // username and password are both required [['id', 'mon'], 'required'], ['id', 'exist', 'targetAttribute' => 'id', 'targetClass'=> '\common\models\User', 'message' => Yii::t('frontend', 'Такого реферала не существует.') ], ['mon', 'number', 'min' => 0, 'max' => Yii::$app->user->identity->mon, 'message' => 'Недостаточно средств на счету!' ], ]; } 

    1 answer 1

    The number type validator has 2 types of user messages tooBig and tooSmall instead of the standard message , replace message with tooBig and will display your message:

     public function rules() { return [ // username and password are both required [['id', 'mon'], 'required'], ['id', 'exist', 'targetAttribute' => 'id', 'targetClass'=> '\common\models\User', 'message' => Yii::t('frontend', 'Такого реферала не существует.') ], ['mon', 'number', 'min' => 0, 'max' => Yii::$app->user->identity->mon, 'tooBig' => 'Недостаточно средств на счету!' ], ]; }