Setup web-to-lead form with dependent country and state fields in Salesforce

This is a question which I came across on the success community and which made me realise that it could be something which admins always look for an answer. Through this blog post I am going to give a simple solution which can even used by a Salesforce Admin who is not good with code. If you are a Salesforce Admin then you simple need to follow these steps.

  • Go to Web-to-Lead Setup and click Create Web-to-Lead Form button
  • Select the fields which you want see on the web form including State/Province and Country
  • Click the Generate button and add the following javascript code at the end of your generated code

 

Sample Complete html file with Javascript code

 

 

JSFiddle to the Web-to-lead form with state and country dependent pick list fields.

https://jsfiddle.net/h3v4msju/

I hope it helps!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.