Improve email error message in forms.
Added a 'type-message' for Parsley to display an error message when the input field is filled in incorrectly. Also removed the global Parsley message to prevent it from overruling the 'required-message'. [MAILPOET-4471]
This commit is contained in:
@@ -34,7 +34,7 @@ class BlockRendererHelper {
|
|||||||
$rules['required'] = true;
|
$rules['required'] = true;
|
||||||
$rules['minlength'] = ModelValidator::EMAIL_MIN_LENGTH;
|
$rules['minlength'] = ModelValidator::EMAIL_MIN_LENGTH;
|
||||||
$rules['maxlength'] = ModelValidator::EMAIL_MAX_LENGTH;
|
$rules['maxlength'] = ModelValidator::EMAIL_MAX_LENGTH;
|
||||||
$rules['error-message'] = __('Please specify a valid email address.', 'mailpoet');
|
$rules['type-message'] = __('This value should be a valid email', 'mailpoet');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($blockId === 'first_name') || ($blockId === 'last_name')) {
|
if (($blockId === 'first_name') || ($blockId === 'last_name')) {
|
||||||
@@ -58,6 +58,7 @@ class BlockRendererHelper {
|
|||||||
|
|
||||||
if (!empty($block['params']['required'])) {
|
if (!empty($block['params']['required'])) {
|
||||||
$rules['required'] = true;
|
$rules['required'] = true;
|
||||||
|
$rules['errors-container'] = '.mailpoet_error_' . $blockId . '_' . $formId;
|
||||||
$rules['required-message'] = __('This field is required.', 'mailpoet');
|
$rules['required-message'] = __('This field is required.', 'mailpoet');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user