icon Contact Form
Created by Orckestra

How to add a contact form on a page

Note. To be able to send messages submitted via the contact form, make sure that you have configured an email host.

  1. Create or edit a page that will serve as a "Contact Us" page.
  2. Insert:
    1. the "Contact Form" component (Components | Forms),
    2. or the Composite.Forms.ContactForm function ( Insert | Function),
    3. or the following code ( Insert | Function Markup) changing the values to your own:
      Expand code
  3. In the required Email parameter, specify the address at which you want to receive messages submitted via the contact form.
  4. If necessary, set its optional parameters:
    • OptionalFields: Optional fields to include on the form if needed. You can additionaly choose to display these fields: 'company', 'website', 'address', 'phone number', 'subject'.
    • FormOptions: Form options such as Use Captcha (the user should enter text from the CAPTCHA image to submit the form) and Show Labels (each field will have a label above). Not enabled by default.
    • EmailTemplate: The email template to use when sending the message.

Note. On the first form data submission, the "Contact Form Data" application will be added to the page to list submitted data. You may need to refresh the page in the tree to see the application below.

Creating email templates

Two email templates are available by default: 'Simple' and 'Extended'. The 'Simple' template only includes values from main fields (the user's name and email address, and the message) while the 'Extended' template includes values from all the fields.

You can create your own templates or customize existing ones.

To create a new template:

  1. In the Content perspective, expand Website Items and select Contact Form Email Template.
  2. Click Add Data.
  3. In the form that appears, on the Template Info, fill these fields:
    • Title: The title of the email template
    • Subject: The subject of the email message based on this template
  4. On the Content tab, add content that you will receive when the user submits a contact form. Please note that you can insert the fields from the contact form (Insert | Field | (field name)).

Changing default form strings

You can change the form strings (field names, information messages, error messages) by editing ~\App_GlobalResources\Composite\Forms\ContactForm.resx.

Localization

You can localize the form's field names as well as error messages by creating a "localized" copy of ~\App_GlobalResources\Composite\Forms\ContactForm.resx (e.g. ContactForm.da-DK.resx for Danish) and translating the strings into the target language. Please see "How to: Create Resource Files for ASP.NET Web Sites" for more information.