The "Submissions" component is responsible for saving form submissions records in the database. It should be some kind of log that saves the user input data + status about the other actions assigned to the specific form. There are 4 subjects that will be explained in this document: database, "save-to-database" action, REST API, and the admin page.
When the admin of the website enable 'submission' experiment the module immediately runs the database migrations (modules/forms/submissions/database/migration.php
) which create 3 tables:
e_submissions
- Holds the submission itself ( related_post, related_form, and some metadata ).e_submissions_values
- Each row has the field key, the input of the user, and the submission_id
.e_submissions_action_log
- The table is a log that represents the other actions that run for the current submission (e.g, email, Mailchimp integration, etc.). Each row has a status, and a log message if exists.This is a regular form action that extends the Base Action of Elementor which does 3 things:
e_submissions
table and multiple rows in e_submissions_values
based on the form fields.e_submissions_action_log
table (this is the reason why the "save-to-database" action must be the first action that runs).To show the admin all the submissions, the module introduces a few REST endpoints that return the submission data:
/submissions
- which returns all the submissions without the values./submissions/:id
- which returns a specific submission with its values./forms
- which returns all the forms fields.The admin page is responsible for showing all the submissions to the admin of the website. The submissions can be sorted, filtered, and exported, and edited. The page itself is built with React to provide a better user experience and uses the REST API as the source of data.
migrations
in modules/forms/submissions/database/migration.php
+ make sure to update the const CURRENT_DB_VERSION
to the new version that you created.max index length
, and charset
for the tables).modules/forms/submissions/personal-data.php
. This class is responsible for exporting and removing the user-specific data, in order to get in line with the rules of GDPR, CCPA, etc.