I want to display custom validation messages for max length and min length of phone number. I have written this code to display custom validation message for max length and min length of phone number field.
['phone', 'string', 'max' => 12, 'min' => 8, 'message' => 'Please enter a valid Phone number.']
The validation is working well however custom message is not being displayed. everytime is shows this default yii2 message "Phone should contain at most 12 characters."
Thanks in advance for help.