Public entity forms: let visitors submit records from your site
Describes Entities 0.7.0.
Any entity can double as a form on a public page, such as a contact form or a sign-up sheet. Each submission is saved as a record of that entity, which you then find on its records page.
Where to find it
Open the entity’s edit form (Edit on the Entities list, or Edit Entity on its records page) and scroll to Public Form Configuration. You need the Entities permission.
Settings in this section take effect when you save the entity with Update Entity, like the rest of the form.
Turning the form on
Enable Public Form switches the form on. Its settings then appear:
- Form Title and Form Description (Optional): shown above the form.
- Submit Button Text: the button’s label. Submit if left as is.
- Success Message: what the visitor sees after a successful submission.
- Form Fields: tick the fields the form should ask for. Fields you don’t tick are only visible in the admin. Section headings and relation fields aren’t offered. If the entity has no fields yet, you’re asked to add some first.
Once at least one field is ticked, an Embed this form: box shows the tag to place on a page, for example <EntityForm entity_slug="contact" />.
The form only shows on the public page when it’s enabled, at least one field is ticked and the entity isn’t archived. Otherwise the page shows This form is currently unavailable.
Security checks
The Security part has these switches:
- Collect Submission Metadata: record the IP address, browser, device and referrer with each submission. On unless you switch it off.
- Debug Mode: show the exact reason to the visitor when a check fails. A warning reminds you to switch it off in production.
- Honeypot Protection: add a hidden field that bots tend to fill in.
- Time-based Validation: catch submissions sent less than 3 seconds after the form was loaded.
- Rate Limiting: limit each IP address to 5 submissions per minute.
Honeypot, time-based validation and rate limiting are off until you switch them on. For each one you choose what happens When triggered:
- Reject with error message: the submission isn’t saved and the visitor sees an error.
- Reject silently (fake success): the submission isn’t saved, but the visitor is told it went through.
- Save but mark as suspicious: the submission is saved as a draft record, with a note of which check it failed.
- Save and log warning: the submission is saved normally and a warning is written to the server log.
What a submission becomes
A submission that passes is saved as a published record of the entity. Its title is taken from a field named name, title, subject or email, in that order, or else the entity’s name. Its slug is made from the title plus a random number. Only the ticked fields are saved.
Form statistics
Once the form has had submissions, Form Statistics shows Total Submissions, Successful and Rejected, and under Security Triggers how often each check fired (Honeypot, Too Fast, Rate Limited), plus the time of the last submission. Reset Statistics clears the numbers when you next save the entity.
What it doesn’t do
- File Upload fields don’t accept files on the public form either.
- Records from the public form are in one language only; add translations afterwards in the admin.
- There’s no email notification on a new submission from this module, and no CAPTCHA.
- A draft entity still accepts submissions; only archiving the entity, or switching the form off, stops them.