This article explains how to make a field required on a Salesforce Web-to-Lead form. When using Salesforce Web-to-Lead, the form that captures lead information from your website is generated as HTML code. By default, form fields are not marked as required, which means leads can be submitted with incomplete data.
Adding the Required attribute directly to the HTML input element enforces client-side validation, displaying an error to the visitor if they attempt to submit the form without completing that field. Note that Salesforce server-side validation rules can also reject incomplete submissions, but these prevent the record from being saved rather than providing a visible form-level message to the user.
To make a text input field required on the Web-to-Lead form, add the word Required at the end of the input tag syntax. The field will then display a browser-native error message if the visitor tries to submit the form without entering a value.
Example for a text input field:
The HTML for a required First Name field looks like this — add Required after the field size attribute:<label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" Required />
For picklist (dropdown) fields on the Web-to-Lead form, add the attribute required="required" inside the opening select tag.
Example for a picklist field:<select id="00NA000000Abtqs" name="00NA000000Abtqs" title="Builder Name" required="required">
The options inside the select element remain unchanged. This attribute instructs the browser to require a non-empty selection before form submission.
Guidelines for Setting Up Web-to-Lead
Generate Leads from Your Website for Your Sales Team
000385229

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.