Important: This article describes a legacy software feature and should not be used by customers starting with MetaLocator since 2019.
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.
You can also control which fields are displayed on this form by using the Visitor Field setting of each field found under Dashboard > Fields. Turn off Visitor Field by clicking the green checkmark, changing it to a red "x". This will hide that field from the form.
One type of field that is useful for the Form Layout is the drop-down list. This allows you to create fields with a fixed set of values from which the user can choose.
In the below screenshot, we've created a new field of type "Drop-Down List", and the form allows use to enter a comma-delimited list of values that will be used to build the drop-down.
Under Field Details, we also designate that as a Visitor Field and save. The field will be rendered on the form as a drop-down list.
You 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
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: