Build a contact form
Model messages as object entries and submit them with a page component and a create query.
1. Object type
Create a collection type (for example contact_message) with fields you need: name, email, message, and optional file or enum fields. Enable public create on the type and grant field write on the fields visitors should fill.
See Object permissions and Permissions concept.
2. Page component
Build a form page component:
- Declare variables for each input (
root.props.variables). - Add
VariableInputBlockrows bound to those variables. - Add a
dataRequestwithop: "create"on your contact type; mapargs.fieldValuesfrom{{var:…}}tokens. - Place a
ButtonBlockwithrunMutationpointing at that request name.
Read Data requests and use save_component_preset with kind: form as a starter.
3. Embed on a page
Drop a ComponentBlock on a public page that references the form component.
4. After submit
Use a lifecycle on the contact type to send email to staff, or list submissions in the admin panel with platform role grants.
Related
- Website users — registration forms use the same pattern with
kind: userand a login query.