In this tutorial we show you how to create a form that allows users to submit locations to your database. This form can optionally alert you via email when you receive new locations. A form is a type of Interface, and with each interface you receive one line of code that you copy and paste to your Web site where you would like that Interface to appear. To get started, first, create a new Interface by going to Interfaces, the clicking New in the toolbar. Choose the Form template as shown below. You may have to scroll down in the window to see it. Give the Interface a Title and then click the Settings Tab to view the various options. Essential settings for consideration include:
- Publish Automatically: Setting this to Yes will automatically publish (for public viewing) data submitted to this form. Be careful with this setting, as it would allow anyone to publish any location content to your site.
- Categories: Choose Categories to display. Leave empty to show all Categories. This setting will only include Categories with Categories > Category Options > Show in front-end location form? set to Yes.
- Show Description Field: This setting controls whether the form displays the location Description field, which allows HTML and links.
- Admin Notify Email: The email address(es) to use to alert when a new entry has been submitted.
- Display ReCaptcha: This will display a spam prevention code to prevent automated submissions.
Required FieldsYou can specify that certain fields by required before the user is allowed to submit the form. To make a field required, add this text to the Validation option found under the Field Details tab as shown below
([^\s].+)This is a RegEx that ensures that anything except nothing or only spaces was provided in the field. This is a strict way of saying the field is required. Any valid RegEx can be placed in this setting. To require a Category, or Description, these special fields have their own option in the Interface Settings as shown here: