Is there a mechanism for returning a error message after (custom) validation of a form?
PHP
$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!
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1366 | 9 years ago | ||
| 2 | 940 | 9 years ago | ||
| 2 | 4069 | 9 years ago | ||
| 1 | 2960 | 9 years ago | ||
| 3 | 1125 | 9 years ago |