Skip to content
New: Customize your theme with an AI assistant. Read the guide

Forms

Files: src/config/config.toml, form fields in content files · Skill level: Beginner

Lotline is a static site, so it has no server of its own to receive messages. Each form sends its answers to a form service you pick, which emails them to you or keeps them in a dashboard. You set that service once in config.toml, and every form on the site uses it.

The Forms And Where They Send

FormWhere it showsFields are inSends to
Inquiry/ (Home 1), /about/, /services/ and every service pagesrc/content/sections/english/enquiry-section.md (or a page’s enquirySection block)contactFormAction
Rental valuation request/home-3/the enquirySection block in homepage/english/home-3.mdcontactFormAction
Viewing requestevery property pageenquirySection in src/content/properties/english/-index.mdcontactFormAction
Development sign-up (“Join the interest list”)every development pageenquirySection in src/content/developments/english/-index.mdcontactFormAction
Valuation request/valuation/src/content/sections/english/valuation-section.md (or valuationSection in pages/english/valuation.md)contactFormAction
Contact/contact/contactPage.form in src/content/contact/english/-index.mdcontactFormAction
Job applicationjob pages, and /careers/#apply when general: trueapplication.form in src/content/careers/english/-index.mdcontactFormAction
Newsletter signupthe pine footersubscription in src/i18n/en.json[settings.subscription] formAction (Mailchimp)

Every form except the newsletter goes through the same provider, contactFormProvider. Each of them sets its own emailSubject, so you can tell a viewing request from a valuation in your inbox.

Some forms send one extra hidden value, so you know what the visitor was looking at:

FormHidden field
Viewing requestproperty: the listing’s title
Development sign-updevelopment: the development’s name
Job applicationrole: the job title. {role} in its emailSubject is filled in too

The valuation request page with the form card

Connect The Forms

The theme ships with placeholder addresses. Until you replace them, messages go nowhere. npm run dev shows a notice inside each form, and both npm run dev and npm run build print a [forms] warning in the terminal. Visitors to a deployed site never see the notice, so read the terminal before you deploy.

Pick a provider and set both lines in [settings] of config.toml:

Free, with no account. Messages arrive by email.

[settings]
contactFormAction = "https://formsubmit.co/[email protected]"
contactFormProvider = "formsubmit.co"

The first message sets off an activation email from Formsubmit. Open it and confirm, or later messages won’t arrive.

After launch, send one real message from each form on the live site and make sure it lands.

The Newsletter (Mailchimp)

The signup row sits at the top of the pine footer, the one Home 2 uses. The other footers have no signup.

  1. In Mailchimp, open Audience, then Signup forms, then Embedded forms, and copy the URL in <form action="..."> from the embed code.
  2. Paste it as formAction in [settings.subscription] of config.toml, in place of the placeholder with YOUR_USER_ID and YOUR_LIST_ID.
  3. The embed code writes &amp; between parameters. Change each one to a plain &.
[settings.subscription]
enable = true # false hides the signup form
title = "" # empty: subscription.title in src/i18n/<language>.json
note = "" # empty: subscription.note (the consent line under the field)
formAction = "https://your-account.us1.list-manage.com/subscribe/post?u=YOUR_USER_ID&id=YOUR_LIST_ID&f_id=YOUR_FORM_ID"
mailchimpTagValue = "" # optional Mailchimp tag id added to every signup

Mailchimp’s bot field is added for you from the u and id in the URL. The form’s title, consent line and messages (sending, success, already subscribed, errors) are in subscription of src/i18n/<language>.json. title and note in [settings.subscription] replace them in every language, which suits a site with one language.

Change The Fields

Every form except the newsletter is written the same way: a form with an emailSubject, a submitButton, an optional note, and a list of inputs. Here is part of the general inquiry form in src/content/sections/english/enquiry-section.md:

form:
emailSubject: "New inquiry from the website" # subject of the email you receive
submitButton:
enable: true
label: "Send my request"
variant: "accent"
inputs:
- label: "Your name"
name: "name" # the field name in the message you receive
placeholder: "First and last name"
type: "text"
required: true
halfWidth: true # two fields per row on wider screens
- label: "Preferred neighborhood"
name: "neighborhood"
placeholder: "Pick a neighborhood"
halfWidth: true
dropdown:
type: "select"
source: "areas" # one option per neighborhood, then the items below
items:
- label: "Not sure yet"
value: "Not sure yet"
Field typeHow to write it
TextNo type, or type: "text"
Email, phone, number, date, web addresstype: "email", "tel", "number", "date" or "url"
Long texttag: "textarea" and rows
Radio buttonstype: "radio", one item per choice, with the same name and group. The first one carries groupLabel, the question. The valuation form’s “Selling or renting out” works this way
Checkboxestype: "checkbox", one item per choice, with a shared group
Dropdowndropdown: with type (select or search) and items (label, value, optional selected and hint). source: "areas" adds one option per published neighborhood before your items

Other options: placeholder, required, defaultValue, value, checked and id. The full list is inputFieldSchema in src/sections.schema.ts. A dropdown item’s hint shows a line of Markdown under the field while that option is chosen.

A page block such as enquirySection in properties/english/-index.md replaces the whole inputs list when it has one, because lists are replaced, not merged. Copy the full list when you change one field.

Success And Error Messages

The last two items of inputs are not fields. The item with note: "success" holds the message shown after the form is sent, and the one with note: "deprecated" holds the message shown when sending fails:

- note: "success" # shown after the form is sent
content: "Thanks, we've got your request. An agent will call or email you within one business day."
- note: "deprecated" # shown when sending fails
content: "That didn't send. Please try again, or email us at {email}."

{phone} and {email} are filled in from [business] in config.toml. Make the success message a promise you keep: “within one business day” is a sample. The field error text (“Check this field.”) and the sending label are in form of src/i18n/<language>.json.

Without JavaScript, every form still sends. It posts straight to the provider, which shows its own confirmation page.

Spam Protection

Every form except the newsletter has two traps, with no captcha for visitors to solve:

  • A hidden field that people never see but bots fill in. Its name matches your provider: _honey (Formsubmit), _gotcha (Formspree) or bot-field (Netlify).
  • A time trap. A form sent less than 4 seconds after the visitor started on it is dropped without a request.

The newsletter uses Mailchimp’s own hidden bot field. Your provider may filter spam on top of this, so check its settings.

Privacy

The contact and job forms have a note that links to your privacy policy. Keep it, add one to the other forms if your region expects it, and name your form provider in src/content/pages/english/privacy-policy.md.

The section files have no schema, so npm run astro-check doesn’t report a mistyped option in them. Open each form you changed, fill it in, and send a test.

Do It With AI

Connect my forms to [Formsubmit with EMAIL | Formspree with form ID | Netlify Forms]: set
contactFormAction and contactFormProvider in src/config/config.toml following its comments. Set
the Mailchimp URL [URL] as formAction in [settings.subscription], with every &amp; changed to &.
Then run npm run dev and tell me if any [forms] warning is left.
Change the viewing request form in the enquirySection block of
src/content/properties/english/-index.md to ask for: [FIELDS]. Keep the two message items at the
end of inputs (note: "success" and note: "deprecated"). Make the same change in the French and
Arabic files, with the labels translated.
Type something to search...