Tips and tricks for Salesforce Admins on web-to-lead forms

The output of a web-to-lead form can look a bit scary if you are not familiar or comfortable with coding, but fear not! Here are some insights on how to tweak your form so it captures the information you need. 

Let’s imagine you work for a company that organises events (who doesn’t like a good party?). We’ll use this example to look at some features and learn how we can improve the lead capture process for the marketing and sales team. 

First things first: You’ll need to know what a web-to-lead form is and what it is capable of doing.

If you haven’t used this feature before, here is a quick summary on what it can do.  

Let’s say the head of marketing wants to make sure that every attendee’s phone number is captured for an event. In order to do that, you need the form to bar people from submitting the form without populating the phone number field. So how will you do this?

This is no problem at all! All you need to do is add ‘required’ to your code line. This would  look like this:

<label for=”phone”>Phone:</label><input id=”phone” type=”number” id=”phone” maxlength=”40″ name=”phone” size=”20″ Required/> 

‘Maxlength’ is only supported by up to date browsers, meaning if someone is using an older version of a browser, they can overrule those settings. Here is a browser checklist you can use to see check what your browser will and will not allow.

Lets now say you organise events for other companies and depending on the size of the event, different teams at those companies would deal with the subsequent leads. How can you make sure that the submitter can select how many attendees they expect at their event?

This sounds like a picklist field! Make sure you have one available on your lead object and enter the options to your field, e.g. 1-50 people, 51-100 people, 100+ people. 

Then you are looking for the <select> element in HTML. 

Here’s an example: 

<label for=”Event size”>How many people will attend your event?:</label>

<select id=”event_size”>

     <option value=”1-50 people”>1-50 people</option>

    <option value=”51-100 people”>51-100 people</option>

     <option value=”100+ people “>100+ people </option>


Now that you can determine the size of the party, let’s say you’d like to send a hidden value for that lead record that shows the preferred language of each lead. This is helpful if you’re a company that operates across Europe and needs to deal with websites in numerous languages.

There is an easy option available if you’d like to track these sorts of details. Once again, do you generally have a field available in Salesforce to capture this information? That is the first step in making sure you can add this as a hidden value. Once you’ve made sure you have such a field, use the hidden function in your code. Hidden function can look like this: 

<input id=”language” name=”language” type=”hidden” value=”French” />

There are lots of other amazing things you can do to format your web-to-lead form and grab the information you’ll need in order to be successful. The output from Salesforce can also be wrapped in CSS styling in order to fit to your website. 

If you’d like to learn more here are some useful links to get started where you’ll find information on additional features. Don’t be afraid of coding, with a little practice you will easily start to get the hang of it!

Guidelines for Setting Up Web-to-Lead

Leads FAQs

HTML basics

HTML 5 Tutorial

Share this post: