Extending a Contact Form's fields

With Sandvox Pro, you can extend the capabilities of a Contact Form to create a more general purpose web form. This creates a custom form that visitors can fill in to send an e-mail to you. It may then be possible to configure your mail client to process these e-mails and perform some additional work.

The Contact Form service is provided by Karelia as a courtesy only. Karelia cannot and does not guarantee the delivery of email through its relay, any spam filters, or other third party systems.

By creating a custom contact form, you can:

To begin construction of the custom Contact Form:

  1. Create a new Contact Form page or pagelet.
  2. Using the Inspector, configure the Contact Form to be as close as possible to what you require.
  3. Select "View → Web View → HTML Source" to view the raw HTML of the page.
  4. Copy the Contact Form source code within the <!-- Contact Element --> comments.
  5. Create a new Raw HTML page or pagelet and set its HTML code to be that you just copied from the Contact Form.

Predefined Inputs

If you look at the HTML code of the form, you will see a number of lines of code like this:

<input id="s185" name="s" type="text" value="" />

This is the code that creates the text field for a visitor to fill in.

The important thing to note is the "name" attribute. If the input name is a single character long (like in the example above), the Karelia service will specially interpret it (see the table below).

The "special," single-character input names that are used by Karelia's mail relay. (Boldface parameters are not generated by the Sandvox contact form, but can be added by you.)

Name Description Notes
a URL of the CSS page of your website This enables the intermediate page to match your own site.
c If set to any value, the sender will also receive a copy of the message sent to you This does not expose your email address, because the originator of the message appears in the "To" field of the message and your address(es) are in the "BCC" field.
e E-mail address of person submitting form Required.
f Footer text, shown on a new line below the message You could specify some fixed text to identify the message as coming from your Sandvox site. \t and \n are converted to tabs and newlines.
l Delimiter to use between the key and value on any additional form inputs (see below) in the resulting e-mail message. Default is ': ' (colon, then space). \t and \n are converted to tabs and newlines.
m Main message Generally entered with a <textarea> input.
n Name of person submitting form
q URL of the page to return to after an error message is shown. If there is an error, first the intermediate page is displayed with the error message; a link from there will return to specified URL.
r URL of the page to return to immediately after the message is sent successfully If not specified, an intermediate page is displayed indicating success; link from there will return to the referring page containing the contact form
s Subject of message If not specified, the subject will be "Contact Form Message From your Sandvox Website" (Hint: Use <select>... <option>... tags to specify a fixed list of possible subjects.)
t Title of originating website Used for the intermediate page. Not required, but error messages will look strange without it.
v Message recipient's encoded email address(es) Required. This can only be generated by the Contact Form page or pagelet in Sandvox; copy it out by using the ViewWeb View → HTML Source of a page with a contact form. (Hint: If you want to let the site visitor specify one of several destination email addresses, you could use <select>... <option>... tags, with each <option> tag's corresponding value being the encrypted recipient address.)
x The name of the 'Send' button Not actually used for processing; it is just listed here for completeness.
y Prefix for message subject If specified, the given string will be a prefix for the message subject, separated by a space. (Hint: This could be a hidden input, or a fixed list as in the "s" parameter.)
z Suffix for message subject As above, but a suffix.

Additional Form Inputs

If the input name is greater than one character long (e.g. "company"), the contents of the field will be included just above the main content of the final e-mail message. You can specify form inputs such as checkboxes, radio buttons, additional text fields, or hidden inputs and pass the values of those fields to the recipient as part of the email message. Please use only alphanumeric characters and "_" for the input name. Spaces will be converted to underscores, and other characters might have unintended effects.

Bringing in the CSS

The standard contact form makes use of some custom CSS to get it to look just right. You will probably want to do the same. You can either embed the CSS styles directly into your inputs, or you could use code injection to load in the contact form CSS (which will hopefully have already been uploaded to your server by the normal contact form).

<link rel="stylesheet" type="text/css" href="_Resources/ContactElement.css" />

Example

You could insert this HTML into the HTML that you copy from the standard form:

<input type="text" name="Company" value="" />
<input type="hidden" name="r" value="http://www.example.com/" />
<input type="hidden" name="FormSource" value="Sandvox" />
<input type="hidden" name ="l" value="\t" />
<input type="hidden" name="c" value="YES" />
<input type="hidden" name="f" value="------\nThis message was sent from Sandvox." />

This would show site visitors an extra field: "Company." All other fields are hidden from them.

In the e-mail you receive, it would contain:

The visitor sending the message would be cc'd on it, and after the message was sent, they would be taken to http://www.example.com

How can we improve this page? Let us know.