Skip to content
Snippets Groups Projects
Commit f5bfdf9f authored by James Williams's avatar James Williams
Browse files

Added validation message for text required to be exact length.

parent aee982d4
No related branches found
Tags 8.x-1.1
No related merge requests found
Pipeline #82838 passed with warnings with stages
in 31 minutes and 31 seconds
......@@ -238,7 +238,11 @@ abstract class TextBase extends WebformElementBase {
}
// Validate character/word count.
if ($max && $length > $max) {
if ($max && $min && $max === $min && $length !== $max) {
$t_args['%max'] = $max;
$form_state->setError($element, t('@name must be %max @type but is currently %length @type long.', $t_args));
}
elseif ($max && $length > $max) {
$t_args['%max'] = $max;
$form_state->setError($element, t('@name cannot be longer than %max @type but is currently %length @type long.', $t_args));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment