|
Custom Forms |
Top Previous Next |
|
Custom Feedback Forms
CMISWebAdmin -> Configuration -> Custom Forms
The following global configuration parameters control the behaviour of this function (all found in CMIS_Data.ConfigParams):
The “Custom Forms” function allows externally-prepared HTML forms to be uploaded into the CMIS database. These are then rendered back to the client browser from external applications using a call to the Binary.ashx handler. Upon submission, the form contents are extracted into an email message which is then sent to the nominated recipient and the user is redirected to the configured confirmation page.
Custom form rules:
This HTML document illustrates all of these requirements:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>My Feedback Form</title> <link rel=”stylesheet” type=”text/css” href=”http://www.mycouncil.gov.uk/styles/default.css” /> <script type=”text/javascript”> <!— function FormValidation(form) { if (NotEmpty(form.Name)) { if (NotEmpty(form.Comments)) { return true; } } return false; } function NotEmpty(elem) { var str = elem.value; if (str.length == 0) { alert(“You must complete all fields!”); return false; } else { return true; } } //--> </script> </head>
<body> <div align=”center”> <img src=”http://mycouncil.gov.uk/images/logo.gif” alt=”Logo” /> </div> <form action=”http://www.mycouncil.gov.uk/CMISWebPublic/ProcessForm.aspx” method=”POST” onSubmit=”return FormValidation(this);”> <table> <tr> <th>Your name:</th> <td><input type=”text” name=”Name” size=”40” maxlength=”50” /></td> </tr> <tr> <th>Comments:</th> <td><textarea name=”Comments” rows=”8” cols=”40” /></td> </tr> <tr> <td colspan=”2” align=”center”> <input type=”submit” value=”Submit” /> </td> </tr> </table> </form> </body> </html>
When a new form is uploaded, its contents are checked to ensure that the code is valid HTML and contains a form although any object paths are not verified (because it is impossible to reliably do so).
Forms stored in the CMIS database are rendered to the client browser by linking to the Binary.ashx handler in the CMIS public application and passing the unique ID of the form to be displayed in the Form parameter in the query string (the form ID is shown on the ManageForms.aspx page in the CMIS admin application). For example, the following code might appear in an external web application:
<a href=”http://www.mycouncil.gov.uk/CMISWebPublic/Binary.ashx?Form=1” target=”_blank”>Send Feedback</a>
Or:
<input type=”button” value=”Send Feedback” onClick=”window.open(‘Feedback Form’,‘http://www.mycouncil.gov.uk/CMISWebPublic/Binary.ashx?Form=1’)” />
When the form is submitted to the ProcessForm.aspx handler, an email is constructed using the parameters described in Configuration (above) and sent to the configured recipient (specified during the upload process – see below). However, it is possible to override one or more of these configuration parameters by inserting hidden form fields into the HTML code prior to upload. Supported values are:
For example:
<form action=”http://www.mycouncil.gov.uk/CMISWebPublic/ProcessForm.aspx” method=”POST”> <input type=”hidden” name=”e_message” value=”Someone submitted this stuff:” /> <input type=”hidden” name=”e_from” value=”someone@mycouncil.gov.uk” /> <input type=”hidden” name=”e_to” value=”someone.else@mycouncil.gov.uk” /> <input type=”hidden” name=”e_subject” value=”Submitted Stuff” /> <input type=”hidden” name=”e_confirm” value=”http://www.mycouncil.gov.uk/altconfirm.htm” /> [etc.]
One, more or none of these hidden fields may be used. Any other hidden fields are ignored.
To upload a form, navigate to the ManageForms.aspx page (see Location above). Click the Browse… button to locate the HTML document to upload, enter a title (free text) and a default recipient email address, then click the Upload button. The form is uploaded and appears in the list of available forms below the upload form.
To preview/test a form, click on the link in the URL column. Note that this also shows the form ID to be used in external references (see Form Implementation above). Also note that the URL shown here is based on the CMISWebPublicURI parameter in the admin site’s Enline.System.Config file and is not necessarily the URL that should be used in external application references.
To edit a form’s default attributes, (title, recipient), click the Edit link next to the form in the forms list. To delete a form, click the Delete link. |