Skip to content

Events: Check if submission saving was triggered by user sending the form? #1574

Answered by engram-design
mandrasch asked this question in Q&A
Discussion options

You must be logged in to vote

Checking whether someone is logged in or not isn't an effective way to check if it was a front-end request. One option is to use Craft::$app->getRequest->getIsSiteRequest() which will let you know if this is a request from the front-end.

But, the EVENT_AFTER_SUBMISSION isn't fired from saving a submission in the control panel. Formie has two paths when it comes to submissions. There's the formie/submissions/submit action endpoint that creates a new submission. formie/submissions/save-submission is for when editing it via the control panel.

So you're really safe to use EVENT_AFTER_SUBMISSION to enact on a form being submitted. This is what email notifications and integrations use to trigge…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mandrasch
Comment options

Answer selected by mandrasch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants