Skip to content

Instantly share code, notes, and snippets.

@leehildebrand
Created September 15, 2016 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leehildebrand/4b3f53786e5685f4777397c031674328 to your computer and use it in GitHub Desktop.
Save leehildebrand/4b3f53786e5685f4777397c031674328 to your computer and use it in GitHub Desktop.
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<HEAD>
<script language="JavaScript" type="text/javascript">
function checkform ( form ){
if (form.name.value == "") {
alert( "Please enter your name." );
form.name.focus();
return false ;
}
if (form.email.value == "" && form.phone.value == "") {
alert( "Please enter an email or phone number where we can reach you." );
form.email.focus();
return false ;
}
var emailregex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(form.email.value != "" && !form.email.value.match(emailregex)){
alert("Please provide a valid email address");
return false;
}
var phoneregex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
if(form.phone.value != "" && !form.phone.value.match(phoneregex)){
alert("Please provide a valid phone number");
return false;
}
return true ;
}
</script>
</HEAD>
<form action="https://yourserverinstance.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8"
method="POST"
onsubmit="return checkform(this);">
<!-- the following fields will appear for the end user to fill out -->
<label for="name">Name</label><input id="name" maxlength="80" name="name" size="20" type="text" /><br>
<label for="company">Company</label><input id="company" maxlength="80" name="company" size="20" type="text" /><br>
<label for="email">Email</label><input id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="phone">Phone</label><input id="phone" maxlength="80" name="phone" size="20" type="text" /><br>
<label for="subject">Reason for Contact</label><input id="subject" maxlength="80" name="subject" size="20" type="text" /><br>
<label for="description">Comments</label><textarea name="description"></textarea><br>
<input type="submit" name="Contact Us">
<!-- these fields will be populated in the background and will not render for the end user -->
<input type="hidden" name="debugEmail" value="your@errorhandling.email"></input>
<input type="hidden" id="external" name="external" value="1" /><br>
<input type="hidden" name="orgid" value="your_org_id">
<input type="hidden" name="retURL" value="http://yourwebsite.com/landingpage">
<input type="hidden" name="recordType" id="recordType" value="Lead RecordTypeId"></input>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment