Members and forms

Add a contact form

Ghost has no contact form of its own. A form sent to Ghost keeps only an email address and a name, and drops a message. A contact form in Fantasma sends what visitors type to a form service you choose. The service stores the messages or emails them to you.

Before you start

  • You have an account with a form service, and a form in it. The service gives you the address the form posts to, such as https://forms.example.com/f/abc123. Many services call it the form endpoint or action URL.

Add the form

  1. Open your project in Fantasma.
  2. Open the block picker in the section where you want the form, as Add blocks to a section shows.
  3. Under Forms, click Contact form. A form with Name, Email and Message fields and a Send message button appears, and its settings open.
  4. In the Form settings, enter your service's address in URL.
A contact form with Name, Email and Message fields on a page, and its settings with Send to set to Custom URL and a form service address

The Page template is the design of every page of your site. To put the form on your contact page only, give that page its own template first, as Design one post, page, tag or author on its own shows.

Send to is already set to Custom URL. Its other choices send the form to Ghost to sign readers up, as Add a newsletter signup form shows. Success message reads Thank you! We will get back to you soon. Change it to your own words.

Change the fields

Each field is a block inside the form, with its own row under Form in the Sections list in the left sidebar. Click a field on the canvas to open its settings. To add a field, click the + on the Form row; the block picker opens with the fields below. To move a field, drag its row. To remove one, select it and press ⌫, or Backspace on Windows.

Field What visitors fill in
Input One line. Type sets what it takes: Email, Name, Text, Phone, Number, Link or Date.
Textarea Several lines, such as a message. Lines sets its height, 2 to 12, 4 by default.
Select One choice from a list. Enter one choice per line in Choices. Placeholder, "Choose one" by default, shows until a choice is picked.
Radio One choice among options shown side by side or in a column. Click each option's text on the canvas to change it, and click the + on the Radio row to add an option.
Checkbox Any number of options, or one box that must be ticked, such as "I agree to the privacy policy".
Hidden Nothing. It sends the text in Value under the name in Field name with every message, such as source and contact-page, so you can tell forms apart.

Turn on Required for a field that must be filled before the form sends. Label shows a label over the field. Click the label on the canvas and type to change its words. Without a label, the Placeholder inside the field names it.

Match the field names to your service

The service receives each value under a field name. Fantasma takes the name from the words of the field's label, in lowercase with hyphens: Name sends name, Message sends message, and a label "Your email" sends your-email. A field without a label sends its type, such as phone. When two fields would get the same name, the second gets -2 at the end.

If your service expects other names, enter the one it wants in the field's Field name. For example, some services read the reply-to address from a field named _replyto. Field name shows only on forms set to Custom URL.

Options send their text. A Select sends the choice picked, a Radio the option picked, and a Checkbox each ticked option, all under the field's name.

What visitors see when they send

  • When the service accepts the message, the Success message appears under the form, and the fields clear.
  • When the service answers with an error, the form shows "Something went wrong. Please try again."
  • When the service refuses messages sent from other sites, the browser sends the form the ordinary way and opens the service's own page. If your service lets you list the domains it accepts forms from, add your site's domain to keep visitors on your page.

The form also holds a field that people never see and spam robots fill in. A message with that field filled shows the success message and is never sent.

The form does not send from the canvas. To test it, put the theme on your Ghost site, as Publish your theme to Ghost and Download your theme and upload it in Ghost show, and send a message from your site.

Was this article helpful?