Submission forms for Custom Item Types allow you to create arbitrary forms that visitors to your site can complete. The basics of setting up these forms are covered in the article Creating Forms for User Submissions. This article describes the options for the notification emails that are sent when a form is submitted.
If you enable the email options when setting up a Custom Item Type submission form, an email will be sent to the person who submitted the form to acknowledge their submission, and to the site admin or specified notification recipients so they know there is new information to be moderated.
You specify the subject lines for these messages in the form options. You can go back to the Database > Item Types page, click the Form icon and click Edit Form Spec to edit that information at any time.
To modify the body of the messages, edit the snippets user_notice_form id and admin_notice_form id, where form_id is replaced with whatever the ID is that you assigned to the form when you created it.
To include information from the form in the notification email, wrap the snippet contents in <w:kb:item> ... </w:kb:item> tags. (Note: in a previous version of the Webvanta system, these tags were not needed, but the ability to access form fields was quite limited. The presence of the w:kb:item tag enables the new behavior, which provides access to all fields.)
The email snippets then behave much like any WebvantaScript page that accesses database content. Simply use the
<w:fieldname /> tag, where fieldname is replaced with the name of the field whose contents you want to insert.
Note: the <w:kb:item> tag must be on the very first line in the email snippet.
For example, consider the following typical code for the user notification snippet:
<w:kb:item> <p>Dear <w:name />,</p> <p>Thank you for your submission. We'll respond as soon as possible.</p> <p>Here's the content you submitted:</p> <p><w:body /></p> <p>Email address: <w:email /></p> <p>Phone number: <w:phone /></p> </w:kb:item>
This example assumes that your custom item includes fields named
Admin notification emails can use all of the same features as described in the preceding section to control the content of the email. In addition, one special field is available. To display a link to view the submitted item in the control panel, use
In some cases, it is useful to be able to set the admin notice recipient dynamically. For example, you may want to put a contact form on different pages of a web site, and have the recipient be different depending on the page.
To prevent a malicious user from using a hacked version of a Webvanta form to send spam, you cannot specify the email address of the recipient as part of the form code. You can, however, use hidden fields to point to a database item (typically a user profile or staff member item) that includes the email address.
The form fields required are as follows:
|cit||Custom Item Type name|
|id||Name or ID of the specific database record. (If using ID, format is ID:nnnn, where nnnn is the item's ID)|
|fieldname||Name of the CIT field that contains the email address (typically "email")|
The name attribute for the fields must follow a particular syntax, exactly as in this example below. In this example, the Custom Item Type is named "staff", the field with the email address is "email", and the staff member's name (which must be in the field "name") is "Chris Haupt":
<input name="connect[receiver][cit]" type="hidden" value="staff" /> <input name="connect[receiver][fieldname]" type="hidden" value="email" /> <input name="connect[receiver][id]" type="hidden" value="Chris Haupt" />
If the database item is found, and the specified field contains a properly-formatted email address, the specified field will be used as the recipient address for the admin notification email. If no match is found, the default admin_contact_email Global Setting value is used.
Note: You could also use a
select field instead of a hidden text field for the ID, if you want to provide the user with a choice of recipients.
By default, the reply address for admin contact messages will be contents of the field named "email", if one exists. This allows the recipient of the admin notice email to reply directly to the person who filled out the form.
You can disable this behavior, if desired, by creating a Global Setting named
admin.form.send.from.user, and setting its value to
false. This will improve the reliability of the notification message delivery, since some mail systems will not deliver mail if the reply-to email address is not valid, and users may enter an invalid email address in the form.
When this setting is set to
false, the default reply-to address is
email@example.com. (For sites created by private-label partners, webvanta.com is replaced by the private-label partner's base domain name.) You can override this and set a specific address as the "from" address by creating a Global Setting named
admin.form.from.email and settings it's value to the desired reply-to address.
If you have a form that includes a file upload, such as for an image, you must add the attribute
moderator="true" to the field that displays the path to the image, or it will not be displayed in the notification email.
For example, the following code will display a submitted image, assuming the field is named "my_image", using the "small" rendition:
<img src="http://www.mydomain.com/rendition.small<w:my_image moderator='true' />" />