function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alberto OvalleAlberto Ovalle 

WEb to lead required fields not working

I created a Web To Lead and modified a couple of extra elements such as header, font size as well as adding the tags to make fields such as name, email - required.
Once I test the html code in the browser works fine.
However, once I intersed in our website page template, the functionality for the required fields is lost.
Any guess what is stopping it from working?
I inserted the form-html  code in a page field which has an html editor. Our org web is a CMS based website.
(btw, I'm not a developer, just a curious html interest)
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Alberto,
I hope it will be helpful.

Please mark it as best answer if the information is informative.

BestRegards
RahulKumar
Alberto OvalleAlberto Ovalle
Thank you Rahul, but the info provided refers to all the work I already did.

Create the form (did that!)
Edit the HTML code with styles, etc.. + added <required> tags  (did that!)
test the form if it works, data received in SF (did that... itworks!)
test the required fileds functionality in a browser or a html tester (did that... it works!)

Paste it on my website... did that... required fileds functionality don't work

Thanks.
 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Alberto,
  • Use this in you Web-to-Lead form.
<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" required/><br>
<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" required/><br>
Hope this will help you.

BestRegards
RahulKumar
Alberto OvalleAlberto Ovalle
Thank you Rahul, 
I've added the code exactly as suggested, still does not work. not sure why.
If I try the code in a browser, it is fine. but again, when I paste it on my web, it doesn't.

Interestingly enough, I've also added: required placeholder="Enter a valid email address"/>   to the email address section, that works fine!
Ajinkya DhasAjinkya Dhas
Hi,

This easy salesforce web-to-lead implementation guide will help you to learn with very simple steps :
https://www.salesforcekid.com/2019/03/salesforce-web-to-lead.html
Salesforce ☁️⚡️ Web-To-Lead Simplified
(Learn. Help. Share.) 
Abe (Abdullah) HabehAbe (Abdullah) Habeh
Have you been able to figure this out. I'm having the same issue. All required attributes inserted into the HTML and tested. all working great. My webmaster took the code and inserted into the website but the required fieldf are not required any more. 
SwethaSwetha (Salesforce Developers) 
Incase anyone is looking for a solution, ensure the attribute for required fields is set as Required="true" not just "Required"

Reference:https://developer.salesforce.com/forums/ForumsMain?id=9062I000000DHKW