icon Form Submit Handler
Created by Orckestra

How to add and use forms with Form Submit Handler

  1. From the Content or Layout perspective, insert the Composite.Forms.FormSubmitHandler function ( Insert > Function), or add the following code:
    Expand code
  2. Specify its required parameters:
    • Form Id: The ID for the form, which will be used when storing data
    • HTML Form path: The path to a file that contains the HTML form to display on a page. See the sample in Creating the HTML form file below.
    • Response path: The path to the file that contains XHTML-formatted response message to display on a page after the form has been submitted. See the sample in Creating the response message file below.
  3. If necessary, specify its optional parameters:
    • Show Form Post: When 'True', the submitted form's "field name: value" pairs are displayed to the user on a page in addition to the response message ('True' by default).
    • Email From: The sender's email address used when sending an email notification.
    • Email Recipients: The list of the recipients' email addresses used when sending an email notification.
    • Receipt Email Field: When specified, a receipt email is sent. This field from the form post is used to get the user's email address.
    • Receipt Email Intro path: The path to the file containing text to put in top of receipt email. See the sample in Creating the receipt email intro file below.
    • Receipt Email Subject: The subject for the receipt email message.

Creating the HTML form file

The form displayed on a page with FormSubmitHandler must be created and saved as an HTML file withing the CMS Website. For illustration purposes, use the sample below:

  1. Create a HTML new file: ~/Frontend/Composite/Forms/FormSubmitHandler/RegistrationForm/HTMLForm.html.
  2. Paste the sample form HTML in the file:
    Expand code
  3. Save the file.
  4. Specify the above path in the HTML Form path parameter of the Composite.Forms.FormSubmitHandler function.

Creating the response message file

The file must be created that contains a response message displayed to the user after the form has been submitted. For illustration purposes, use the sample below:

  1. Create a new HTML file: ~/Frontend/Composite/Forms/FormSubmitHandler/RegistrationForm/Response.html.
  2. Paste the sample response in the file:
    Expand code   
  3. Save the file.
  4. Specify the above path in the Response path parameter of the Composite.Forms.FormSubmitHandler function.

Creating the receipt email intro file

When sending email notifications, an introduction text can be optionally supplied for the email message in addition to the input data supplied automatically. For illustration purposes, use the sample below:

  1. Create a new HTML file: ~/Frontend/Composite/Forms/FormSubmitHandler/MyEvent/ReceiptEmailIntro.html.
  2. Paste the sample introduction text in the file:
    Expand code
  3. Save the file.
  4. Specify the above path in the Receipt Email Intro path parameter of the Composite.Forms.FormSubmitHandler function.

Viewing saved input data

Once the form has been submitted, the input data filled out by the user is saved in an XM file as "field name" = "value" pairs. For the samples presented above, you can find the file here:

~/App_Data/FormSubmitHandler/RegistrationForm/

The following is the sample of the saved input data:
Expand code


When accessing these XML files from the System or Layout perspectives, you can view it in Microsoft Office Excel as a table:

  1. In the System or Layout perspective, expand ~/App_Data/FormSubmitHandler/RegistrationForm/
  2. Right-click the XML file in the folder.
  3. In the context menu, click Export to Excel.
  4. When prompted, select Open withMicrosoft Office Excel and click OK.
  5. Click Yes, when informed about a file extension different from the file format.

In general, the path to the XML file with saved input data is built up as:

~\App_Data\FormSubmitHandler\[FormID]\[YYYYMM].xml

where:

  • [FormID] is the From ID specified in the Form Id parameter of the Composite.Forms.FormSubmitHandler function ("RegistrationForm" in the above sample)
  • [YYYYMM] is the current year (4 digits) and month (2 digits) ("201002" in the above sample)

Important Notes

  1. To remove unwanted elements from the email, please use the class="hidefromemail" attribute.