Is there a mechanism for returning a error message after (custom) validation of a form?
$event->stopPropagation();
return;
just returns the user to the form.
Is there a mechanism for returning a error message after (custom) validation of a form?
$event->stopPropagation();
return;
just returns the user to the form.
Have a look at the Form plugin’s onFormProcessed
method in the form.php
file, where you’ll find some lines of code similar to:
$this->grav->fireEvent('onFormValidationError',
new Event([
'form' => $form,
'message' => 'some message'
]));
$event->stopPropagation();
return;
That should work for you.
It sure did, thank you!