You need to sign in to do that
Don't have an account?

Web-To-Lead Validation
Hello,
I have currently created the below web-to-lead form but I am having trouble with a couple things. What code/script would I need to input to ensure the email field does not allow email addresses from gmail, yahoo, hotmail, etc...? Also, how do I make certain fields like first name, last name, email, and web site required fields?
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="00Dc0000003kLYk">
<input type=hidden name="retURL" value="http://streamlinx.com/thank-you/">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: These fields are optional debugging elements. Please uncomment -->
<!-- these lines if you wish to test in debug mode. -->
<!-- <input type="hidden" name="debug" value=1> -->
<!-- <input type="hidden" name="debugEmail" -->
<!-- value="example@example.com(for privacy purposes)"> -->
<!-- ---------------------------------------------------------------------- -->
<label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
<label for="last_name">Last Name</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="text" /><br>
<label for="email">Email</label><input id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="company">Company</label><input id="company" maxlength="40" name="company" size="20" type="text" /><br>
<label for="city">City</label><input id="city" maxlength="40" name="city" size="20" type="text" /><br>
<label for="state">State/Province</label><input id="state" maxlength="20" name="state" size="20" type="text" /><br>
<label for="URL">Website</label><input id="URL" maxlength="80" name="URL" size="20" type="text" /><br>
<input id="00N80000005owbR" name="00N80000005owbR" type="hidden"><br>
<input type="submit" name="submit">
</form>
I have currently created the below web-to-lead form but I am having trouble with a couple things. What code/script would I need to input to ensure the email field does not allow email addresses from gmail, yahoo, hotmail, etc...? Also, how do I make certain fields like first name, last name, email, and web site required fields?
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="00Dc0000003kLYk">
<input type=hidden name="retURL" value="http://streamlinx.com/thank-you/">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: These fields are optional debugging elements. Please uncomment -->
<!-- these lines if you wish to test in debug mode. -->
<!-- <input type="hidden" name="debug" value=1> -->
<!-- <input type="hidden" name="debugEmail" -->
<!-- value="example@example.com(for privacy purposes)"> -->
<!-- ---------------------------------------------------------------------- -->
<label for="first_name">First Name</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
<label for="last_name">Last Name</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="text" /><br>
<label for="email">Email</label><input id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="company">Company</label><input id="company" maxlength="40" name="company" size="20" type="text" /><br>
<label for="city">City</label><input id="city" maxlength="40" name="city" size="20" type="text" /><br>
<label for="state">State/Province</label><input id="state" maxlength="20" name="state" size="20" type="text" /><br>
<label for="URL">Website</label><input id="URL" maxlength="80" name="URL" size="20" type="text" /><br>
<input id="00N80000005owbR" name="00N80000005owbR" type="hidden"><br>
<input type="submit" name="submit">
</form>
All Answers
I have updated your code - this should serve both the purpose. You can customize further with your needs.
Please mark resolved and best answer if this helps. thanks.
I have placed this code on a private page on my web site. The required fields are working great! However, the email address filtering is not working as it is allowing me to put in any email address I want.
Please use the below code and it should serve the purpose :)
I greatly appreciate your help and patience with this. Unfortunately this is still not working with the email field. It is allowing me to put in whatever email address I like. Would you like me to provide you with the link to the page so you can look into it yourself?
I see the code is present but since I cannot modify it - can you please try to put javascript alert statements to check whether the method 'checkEmailAddress()' is called or not. Also - put alert statements in the if conditions to check where exactly the code is not working.
I have never worked with JS before, so if you could please help me out with providing what you want me to add, that would be helpful.
Thank you.