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
LeifKLeifK 

Web2Lead form Validation of custom fields

Does anyone have experience with required custom fields on Web2Lead forms?

Our web form contains the following onSubmit validation:  


<form onSubmit="MM_validateForm('first_name','','R','last_name','','R','email','','RisEmail','phone','','R','company','','R');return document.MM_returnValue" method="post" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">

I would like to also add some custom fields to that list, but it seems like I need to add the field id (00N800000054JbO) which creates ridiculous-looking error messages for the user ("00N800000054JbO is required" instead of "Product Name is required"). If I put anything other than the id in the validateForm, the Lead is created but without data from any of the required fields.
Any suggestions/workarounds/3rd party extensions would be greatly appreciated.
thanks,
Leif
Best Answer chosen by Admin (Salesforce Developers) 
b-Forceb-Force

I think it will be really great if you validate all fields by using javascript,

Once you generate html for web2Lead , then add javascript code to validate each field.

 

Thanks,

bForce

 

All Answers

b-Forceb-Force

I think it will be really great if you validate all fields by using javascript,

Once you generate html for web2Lead , then add javascript code to validate each field.

 

Thanks,

bForce

 

This was selected as the best answer
AmitSahuAmitSahu

Yes, this is the best way yo do it..