According to documentation, a plugin may interrupt contact form submission by returning an exception onValidateContact
. While it does indeed interrupt submission, the user is redirected to the contact form URL, but without any of the contact form components or a meaningful error message.
Here is a sample code snippet that should reproduce this issue:
<?php
defined('_JEXEC') or die;
class plgContactValidation extends JPlugin {
protected $autoloadLanguage = true;
function onValidateContact($contact, $data) {
return new InvalidArgumentException("Exception message is not shown.");
}
}
?>
User should be redirected to the contact form URL, with the form pre-filled with submitted values and the exception message explaining why the submission was rejected.
User is redirected to the contact form URL, but without any of the contact form components or a meaningful error message.
This issue afflicts Joomla! 3.x and 4.x.
I have previously submitted a PR #37540 that resolves this issue by handling an exception onValidateContact
the same way com_contact
handles failures in its default validation.
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-04-20 06:19:48 |
Closed_By | ⇒ | richard67 |
Hey @richard67, sorry about that. First time contributing, not sure what the protocol is.
Could I trouble you to check if you are able to view my PR? When I first submitted it, I'd just created my GitHub account and it was "flagged" and I had a big red banner across the top of every page telling me other users would not be able to see me due to the "flagged" status. The status was eventually cleared yesterday and since there had not been any activity on the PR, I thought maybe it was a rule to also open an issue. Thank you!
@beefcakefu Your PR is visible for me and seems to be ok.
Closing as having a pull request.
@beefcakefu It doesn’t need to crate an issue when there is already a pull request to solve it.