I am using Yii2 ActiveForm to make a default templated registration form. In the form the user must specify a signup key in order to complete the registration. The signup key must have a length between 6 and 10 characters.
I have deleted all other validation rules for my form except the one I am having trouble with. The rule is being applied, but is rendering a default form validation message.
Here is the rule in question:
[
'betaKey',
'string',
'length' => [6, 10],
'message' => 'Signup Codes are between 6 and 10 characters.'
]
The above rule is being applied, I know this because when I change the length to [2, 10]
the rule is no longer triggered. I have read the documentation, though please feel free to let me know if I have missed something.
Here is the javascript being rendered by Yii:
yii.validation.string(value, messages, {
"message": "Signup Codes are between 6 and 10 characters.",
"min": 2,
"tooShort": "Beta Key should contain at least 2 characters.",
"max": 10,
"tooLong": "Beta Key should contain at most 10 characters.",
"skipOnEmpty": 1
});
message
is never rendered by the validator. All other core-validators in Yii2 use message
for specifying a custom error message. Why is that not the case here?