Creating a Contact Form in Freeway
12th of April, 2012Creating a contact form in Freeway is very easy. On the face of it all forms are the same, they contain one or more input items that visitors of your site can type inside or select, and a submit button. When the submit button is clicked, the text entered and options selected by the visitor is sent off to an email address (or addresses) of your choice. How this happens depends on your hosting package so it will be different for some people. The following steps require you to have PHP on your server, they won't work on MobileMe or servers that don't support PHP.
If you require a host that supports the PHP Feedback Form then we have fully tested and recommend using FatCow, or InMotion hosting.
Creating the Form
- Start off by drawing a table on the page, this will be used to line up the form elements on the page. Click the Table toolbar icon and draw the table on the page. The number of rows and columns will depend on the amount of data you want to get from visitors, but, for the purpose of this tutorial, give the table 4 Rows and 2 Columns. Set the Spacing to 5px and the Padding and Border to 0px.
- Double click inside the first cell and type Name:
- Double click inside the second cell and select Text Field from the Insert menu
- Select this item and in the Inspector palette's third pane (Item Output settings) enter name in the Name field
- Enter Email: into the first cell of the second row
- Insert another Text Field into the second cell of the second row
- Enter email in the Name field of the Inspector's Item Output settings.
- Enter Message: in the first cell of the third row
- Double click inside the second cell on the third row and this time select Text Area from the Insert menu
- Enter message in the Name field of the Inspector's Item Output settings.
- Double click inside the second cell of the fourth row and select Button from the Insert menu. This will be a submit button by default
- Change the appearance of what you have to fit in with your design, if you are finding that the form items you have are smaller in preview than they are in Freeway then use the Freeze Form Action to force them to a specific pixel width and height.
Controlling the Form with a ScriptYou will now have a form on your page, the final steps are to set this form up so it can be sent to your email address.
The recommended way doing this is with PHP, so contact your host to find out if your hosting package supports it. Don't worry, you won't need to learn PHP to do this, just download and install the PHP Feedback Form Action (it's available for Pro and Express).
Assuming that your server supports PHP:
- Open the Page Actions menu from the Page menu and select PHP Feedback Form
- Open the Actions palette by selecting Actions from the Window menu (if you see an error message in the Actions palette stating that the Action requires AppleScript, go to Preferences in the Freeway dropdown menu and switch on the "Enable AppleScript in Actions" option)
- In the Error Page pulldown choose Other...
- In the Hyperlink dialog that appears click New Page. Call the page Error.html (this new page will be displayed if there is a problem sending your form)
- Select Error.html and click Ok
- In the Success Page pulldown choose Other...
- In the Hyperlink dialog that appears click New Page. Call the page Thanks.html (this page will be displayed if there are no problems sending your form)
- Select Thanks.html and click Ok
- Type your email address into the Email Recipient field
- Amend the Error and Thanks pages to match your design
- Upload your site using the Upload dialog from the File menu to test it
Formmail tutorial (Perl/CGI)
You might also be interested in looking into using a third-party form creation method such as FormsToGo from Bebosoft which lets you set up a form which works using PHP, ASP or Perl/CGI. Please note that you will need to contact Bebosoft for support for making forms with FormsToGo.
Another excellent PHP Action can be found here along with superb documention: easiForm with Freeway