Web Forms
Let visitors and portal users create and edit Records from the website.
A Web Form puts a form for one RecType on the website. Visitors fill it in without the desk. Only a System Manager creates Web Forms.
The RecType must opt in with allow_web_form: true in its YAML, or Allow Web Form on a desk-built RecType. Of core's RecTypes, only Address does.
Example: a contact-us form
Say an app ships a Website Enquiry RecType with allow_web_form: true.
Open /desk/web-form/new. Set Title Contact us and RecType Website Enquiry. Route fills as contact-us.
Add rows to Fields: full_name (Mandatory), email (Mandatory) and message. Set a Label to override the field's own.
Write an Introduction, set Button Label Send and Success Message Thanks, we will reply within a day.
Tick Allow Guest and Published, then save. Visitors can now open /contact-us.
Routes
| Path | Shows |
|---|---|
/contact-us | The form, for a new Record |
/contact-us/new | The same |
/contact-us/list | The signed-in user's own Records, with Show List on |
/contact-us/<name> | One Record, for users who can read it |
/contact-us/<name>/edit | Editing, with Allow Editing After Submit on |
Settings
| Field | Effect |
|---|---|
| Published | The form is live |
| Allow Guest | Visitors who are not signed in may submit, 10 a minute per address |
| Allow Multiple Responses | Without it, a signed-in user keeps one Record |
| Show List | Signed-in users see their own Records at /<route>/list |
| List Columns | The list's columns. Empty uses the title, status and list view fields |
| Allow Delete | Users delete their own Records from the list |
| Allow Editing After Submit | Users who can write a Record edit it at /<route>/<name>/edit |
| Success URL | A path on this site to go to after a submit, such as /me |
Each field row can also be Read Only or Hidden. A form takes only the RecType's level 0 fields of plain data types. Attach fields upload with the submit.
What a form can write
The form writes only the fields it lists. A published form gives its users the right to create Records of that RecType through it, and Allow Delete the right to delete their own. Everything else follows the user's normal permissions.
A route that a page, a reserved path or another form already uses is refused on save.