Developer manual

Spring Web Forms: Email Example

The following is an example of the required Form Field Definitions to create a basic email form. An example of the finished form can be seen on the Millstream contact page.

See Also: Spring Web Forms for an introduction to using Spring Web Forms

To create a basic web form - start by adding an additional 5 Form Field Definition sections by clicking the 'Add a row' link in the first Form Field Definition section 5 times.

Through this process make sure you save often.

Standard hidden fields for an email form

Start by creating the hidden fields which tell Spring what to do with the form when it's submitted.

  • Type: Hidden
  • ID: to
  • Value: <email@address> The email address the form will be sent to, usually the website owners email address. You must notify Millstream of the address you have entered here so we can whitelist the address in our spam prevention system.
  • Type: Hidden
  • ID: subject
  • Value: <the subject line for the email>
  • Type: Hidden
  • ID: redirect
  • Value: <url of the page to go to after the form is submitted> This must be a valid URL for a page you have created. ie. '/view/contact/thankyou/'

Now the standard hidden fields for an email form are setup you can create the fields that will appear on the website for visitors to complete.

Form fields

The following fields will be visible on the website allowing visitors to fill in their details. You would modify or add additional fields to suit your needs.

Create a field for visitors to enter their name:

  • Type: Text
  • Label: Name
  • ID: name
  • Required: [checked]

Create a field for visitors to enter their email address:

  • Type: Text
  • Label: Email
  • ID: email - if you give this field an id of 'email' this will be used as the 'from' address when you recieve the email - allowing you to simply reply to the email.
  • Validate: Email
  • Required: [checked]

Create a field for visitors to enter in their message:

  • Type: Textarea
  • Label: Message
  • ID: message
  • Required: [checked]