# Forms

Server-rendered forms have accepted posts since version 0.9.0. Declare a form in the page's front matter. The names below are page fields, not `config.toml` redirects.

```toml
+++
title = "Contact"
template = "page.tera.html"

[form.contact]
success_redirect = "/contact/thank-you/"
failure_redirect = "/contact/"
honeypot_field = "website"
required_fields = ["email", "message"]
notify_template = "emails/contact.txt"
notify_subject = "New contact"
+++
```

`success_redirect` and `failure_redirect` are where the form sends the browser. They are not `[[redirects]]` and they are not `[auth.role_redirects]`.

Site-wide defaults:

```toml
[forms]
default_honeypot_field = "website"
notify = ["ops@example.com"]
```

`notify` is the recipient list. A form emails only when it sets `notify_template` and `notify` is non-empty. `BENSON_FORMS__NOTIFY` overlays that list. An empty value clears it. In development, notification email is logged instead of sent.

`promote_role` grants a role on success. `skip_if_role` skips the form for those roles. `sync_to_session` stores submitted values on the session.

