HOC SiteDocumentation

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:

  1. Declare variables for each input (root.props.variables).
  2. Add VariableInputBlock rows bound to those variables.
  3. Add a dataRequest with op: "create" on your contact type; map args.fieldValues from {{var:…}} tokens.
  4. Place a ButtonBlock with runMutation pointing 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.

  • Website users — registration forms use the same pattern with kind: user and a login query.