Customizing WebForms

Updated on 17-August-2017 at 6:16 PM

Business Catalyst End of life announcement - find out more details.

Customizing the Auto Responder

You can customize the way that auto-responder emails are sent to people filling in your web forms.

Within the Site Manager options you need to go to Web Forms, click on the relevant Web Form and click on Setup Auto Responder.

Fill in the following fields:

  • Email From Address - Use the following format: "John Smith" johnsmith@yourdomain.com
  • Email Subject
  • Email Format - HTML or Text (Text emails are less likely to be blocked by a spam filter)
  • Template - You can choose an HTML template. Edit these in Admin -> Manage Site-Wide Templates

To personalise the response, you can use the following tags (click on the "Tag Manager" icon in the editor):

  • {tag_emailaddress} Email address of the recipient (email address must be present on form)
  • {tag_recipientname} Full name of the recipient (firstname and lastname must be present on form)
  • {tag_webformresults} Summary of the form that was filled out (only use if email format is HTML)
  • {tag_recipientfirstname} First name of the recipient (first name must be present on the form)
  • {tag_recipientlastname} Last name of the recipient (last name must be present on the form)
  • {tag_verificationurl} The verification URL for customer to select and opt-in to your newsletter

Disabling the Auto Responder

You can disable the auto responder if desired. To do this, you will need to alter the form action URL by adding &SAR=False

For example:

action="/FormProcessv2.aspx?.....&SAR=False"

Disabling the Secure Zone login details email

Upon creating a webform which collects the username and password fields and subscribes the submitting contact to a Secure Zone an email is sent to the submitter with the login details he can use for that secure zone. If you wish to disable the sending of this email simply append the following to the action URL of the webform: 

action="/FormProcessv2.aspx?.....&SWE=False"

Customizing your Web Form after inserting

Use this method when customizing an individual form, used only in one place. Web forms are customized after they are inserted on a web page and you can then customize it by editing the HTML code, adding CSS classes or replacing buttons with images. You can also re-arrange the fields. Any customizations you make will only affect the copy of the web form on the page.

Note: It's important that you test the web form after making changes to it by making a few submissions through it. This ensures that whilst customizing the web form you have not broken the form.

If you make changes to your web form via Modules -> Web Forms then you must re-insert your web form on any web page where the web form was previously placed. 

Collecting anniversary dates using a date picker

For each customer you can store up to 5 anniversary dates. These dates are used for loyalty email campaigns. Refer to an earlier section for more details. To capture this information, include the following your web form:

<input name="Anniversary1" id="Anniversary1" readonly onfocus="displayDatePicker(&#39;Anniversary1);return false;">

You can also replicate the above for anniversaries 2 to 5, e.g. Anniversary2, Anniversary3 and so forth.

Customizing your Web Form using the 'Customize Web Form' option

Use this method when you have inserted the Web Form as a module. This method allows you to make a change to the form via the 'Customize Web Form' option and have this automatically update throughout the site where you have inserted the web form as a module:


When updating the web form via the 'Customize Web Form' option, this allows you to update all instances of this form from one central place.

Note: These customizations will not be reflected when inserting the web form in a web page as HTML (instead of using the module). Also, they will not be reflected when using the “Get Web Form HTML Code” option under “More Actions” menu.

Note: You can not insert a web form as a module in your Registration(buy) layout for your ecommerce shop as this must be inserted as HTML.

Combining the first name and last name into a full name

You can combine the First Name and Last Name fields of a web form as a single 'Full Name' field by modifying the Form HTML Code, and changing the First Name input HTML Code to 'Fullname'....

For example, this field:

<tr>  
<td><label for="FirstName">First Name <span class="req">*</span></label><br />  
<input type="text" name="FirstName" id="FirstName" class="cat_textbox" maxlength="255" /></td>  
</tr>

Can be updated like this:

<tr>  
<td><label for="FullName">Full Name <span class="req">*</span></label><br />  
<input type="text" name="FullName" id="FullName" class="cat_textbox" maxlength="255" /></td>  
</tr>

Then delete the 'Last Name' input field alltogether.

You will need to update the javascript validation at the bottom of the form. 

You will need to look for the following: 

if (theForm.FirstName) why += isEmpty(theForm.FirstName.value, "First Name");if (theForm.LastName) why += isEmpty(theForm.LastName.value, "Last Name")

You need to remove the last name part completely. 

Delete:

if (theForm.LastName) why += isEmpty(theForm.LastName.value, "Last Name")

You will then need to update the FirstName references to FullName as below:

if (theForm.FullName) why += isEmpty(theForm.FullName.value, "Full Name");

A quick example of this can be found here: http://jsfiddle.net/yeqgU/2/ . Once completed, the system will separate a fullname (i.e. Tom Jones) into a first and last name (i.e. Firstname-Tom, Lastname-Jones) upon form submission.

Attaching web forms to Contacts instead of Cases

Sometimes you want to attach a custom web form field to the customer record rather than the case. You can do this by simply appending a variable to the action URL of the web form

Append ECRM=1 to the action URL of the web form

Example:

action="/FormProcessv2.aspx?WebFormID=11557&OID=248384&OTYPE=1&EID=0&CID=0&ECRM=1

Adding multiple file attachment fields to the web form

To add multiple file attachment fields to your form, you can simply copy the HTML code of the original field and paste it between the <form> tags.

This is the example of the code:

<input name="FileAttachment" class="FileAttachment" class="cat_textbox" type="file">

You can also change the name and id of the new field in the following manner:

<input type="file" name="FileAttachment1" id="FileAttachment1" class="cat_textbox" /><input type="file" name="FileAttachment2" id="FileAttachment2" class="cat_textbox" />

This will then allow you modify the JavaScript validation if you would like to make any of these fields mandatory.For example, where you see:

if (theForm.FileAttachment) why += isEmpty(theForm.FileAttachment.value, "File Attachment");

You can change the (theForm.Fileattachment1) to look like below:

if (theForm.FileAttachment1) why += isEmpty(theForm.FileAttachment1.value, "File Attachment");

duplicate this for fileattachment2. Please have in mind that the upload cannot exceed 250 MB and only the first file will be included in the workflow notification even though multiple files are uploaded.

Preventing autocomplete on web form fields

A lot of browsers have an 'AutoComplete' function which enables them to 'remember' previously submitted information to that form field.

If you don't want to the browser to pre-populate the field you need to place autocomplete="off" attribute into that field.

For example -

<input type="text" maxlength="255" class="cat_textbox" autocomplete="off" id="FirstName" name="FirstName" />

Redirecting the Web Form confirmation page

To redirect a Web Form submission to the another page, you will need to go to the page you have placed the Web Form on and view the HTML of this page. Find the form action URL, this should looks similar to the below:


Change this by appending the below to the action URL:

&PageID=/Results.htm

Where Results.htm is the URL of the page of the next Web Form

Pre-populate web form fields

You can use the following module tags to pre-populate the form:

{module_fullname} {module_emailaddress}
{module_firstname} {module_lastname}
{module_title} {module_company}
{module_homeaddress} {module_homecity}
{module_homezip} {module_homestate}
{module_homecountry} {module_workaddress}
{module_workcity} {module_workstate}
{module_workzip} {module_workcountry}
{module_webaddress} {module_workphone}
{module_workfax} {module_homephone}
{module_homefax} {module_cellphone}
{module_dob} {module_username}
{module_password} {module_shippingaddress}
{module_shippingcity} {module_shippingzip}
{module_shippingstate} {module_shippingcountry}
{module_billingaddress} {module_billingcity}
{module_billingzip} {module_billingstate}
{module_billingcountry}  

Note: This only works inside Secure Zones, because the subscriber must be logged into a site in order for the system to recognize them and populate the form with therelevant data.

For security purposes, the billing address of a customer is always stored with the order information (and is never stored with the customer detail records).

When the system displays the billing address using the {module_billingaddress} tag, the system always displays the last billing address that the customer used when placing their most recent order.

You can pre-populate a form's fields using the module tags listed above. Edit the form and place the desired module tags inside the field values.

Editing form fields to insert module tags

Follow these steps to update an existing form's fields to pre-populate the data with the system's data.

Edit the web page that contains the form. Click the HTML tab to view the source code.

Scan the code to locate the field that you want to pre-populate. In the example below, the line of code that creates the text field that contains the subscriber's user name is displayed:

<input class="cat_textbox_small" type="text" name="Username" maxlength="255"/>

To pre-populate this field, add value="{module_username}" to the end of the field code, like this:

<input class="cat_textbox_small" type="text" name="Username" maxlength="255" value="{module_username}"/>

Setting up a form to email using Web Forms

You can configure a form to send the data to a user's email address, rather than storing it in the database. This strategy enables you to create simple web form with email functionality that forwards the details of a web form submissions to a pre-designated email address.

To set up a web form to forward the submitted data, follow these steps:

  1. Create and insert a web form on a page.
  2. Update the action URL in the source code of the form to use the format shown below:
    action="/Default.aspx?A=Form&Email=You@YourDomain.com&Subject=This+is+email+subject&EmailFrom=yourfromemail@YourDomain.com&ID=/DestinationPage.html"

In the example above:

  • &Email=You@YourDomain.com - The email address to which the submission is sent. Replace ?You@YourDomain.com ? with your email address.

    Note: The email address that will be receiving the form submission must exist in either your sites CRM (customer database) or be an admin/email user of the site.

    If the email address being used to receive these form submissions does not exist as a site user or in the CRM, then the email will not be sent. A notification will be sent to the partner of the site advising them of this requirement.
  • &Subject=This+is+email+subject - The subject of the email. Make sure you separate each word in the subject with the + (plus) sign.
  • &EmailFrom=yourfromemail@YourDomain.com - The from email address. Replace yourfromemail@YourDomain.com with the email address you want to use for the submission.
  • &ID=/DestinationPage.html - The URL of the landing page presented to the visitor after the web form has been submitted.

For more details, see the this article .

Customize the webform confirmation page

With the introduction of the BC.Next rendering engine one can now customize the webform confirmation page as well. Have a look at this widget on how to customize the system's form confirmation layout.