Step 4: Format the Response or Redirect Page (Optional)
The MailTo CGI provides a default page that is displayed to the user after they submit a form. You can customize this page by creating a response template and referencing the template in the form with a hidden field. Or, you can redirect the user to a web page. The redirect page can be an existing page, such as a homepage, or it can be one you've created with any information you would like to convey, such as "Thank you" or "Your information has been submitted."
IMPORTANT: If you are using the Content Management System to develop your web pages, you MUST use the RedirectURL option presented further down on this page.
To create a customized response page (do NOT use this option with the CMS)
Note: If you specify the code for both the RedirectURL and the ResponseForm, the RedirectURL will be used and ResponseForm will be discarded.
- Create an HTML page named with the extension ".html" (e.g. response.html).
- If you want to use any of the submitted information on your response page, enter the variable name (field name) exactly the same as the field in your form. It's important to keep in mind that field names are case sensitive.
IMPORTANT: If you are developing your forms in the Content Management System (CMS), do not use variables in the response page. This feature is not supported.
The variable in the response page has the format:
Where VariableName is the name of the field in your form. For example, if you create a text box named "Name", the variable would be represented in the response template as %Name.
Continuing with our form example, a response template (named "response.html") might look like this:
<p>Thank you %Name for using my form. You indicated that your userid is %UserID.</p>
- To reference the response template in your form's html, you must add the hidden field, "responseform" with the value set to the name of your response form template. Be sure to add this line after the <form> tag but before the </form> tag.)
Depending on where you are publishing your pages (www.cmu.edu or www.andrew.cmu.edu), add the line in one of the following formats:
- If you are using the Andrew Web publishing system to publish on www.cmu.edu enter the line as follows:
<input name="ResponseForm" type="hidden" value="http://www.cmu.edu/url/name.html" />
Where url is your web site address and name.html is the name of the response form page.
- If you are publishing on www.andrew.cmu.edu, enter the line as follows:
<input name="ResponseForm" type="hidden" value="http://www.andrew.cmu.edu/user/userid/name.html" />
Where user and userid reflects your Andrew user/user ID and where name is the name of the response form page.
Note: All files to be published must be located in a www directory within your AFS space. For more information about publishing pages on www.andrew.cmu.edu, see Publishing Course, Organization or Personal Pages.
To redirect to a generic response webpage:
This option is for redirecting users to a web page that does not contain variable information generated from the web form, in other words, a generic "Thank you" web page. This web page cannot be used in addition to the Response Form option above.
Note: If your form content was developed in the CMS, you MUST use this option.
- Create an HTML page named with the extension ".html" (e.g. thanks.html) with any information you would like the user to see. For example, a page with the text "Your form has been submitted" in the body. The webpage can have the extension ".html", ".htm", ".shtml", or ".shtm".
Note: CMS users do not need to specify the extension when creating their webpage.
If you are simply redirecting the user back to your homepage, you do not need to create a page in this step.
- To redirect the user, you must add the hidden field, "RedirectURL", with the value set to the URL of the page you would like them to see. Be sure to add this line after the <form> tag but before the </form> tag.
The RedirectURLcan be a www.cmu.edu or www.andrew.cmu.edu address only. Users cannot be redirected to a site outside of the university.
- If you are redirecting the user to a page that you created, enter the line as follows:
<input name="RedirectURL" type="hidden" value="http://www.cmu.edu/foldername/Name.html" />
Where foldername is your web site address and Name.html is the name of the webpage you created.
- If you are redirecting the user to an existing webpage enter the line as follows:
<input name="RedirectURL" type="hidden" value="http://www.cmu.edu/foldername/" />
Where FOLDER is path to the existing website.