Created
March 20, 2013 15:43
-
-
Save amusarra/5205736 to your computer and use it in GitHub Desktop.
SugarCRM Web form to lead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang='en_us'><body><script type="text/javascript" src="http://sugarcrmpgsql-shiruslabs.rhcloud.com/cache/include/javascript/sugar_grp1.js?v=QMfyElAturj9vuK-tY9lzw"></script> | |
<script type="text/javascript" src="http://sugarcrmpgsql-shiruslabs.rhcloud.com/cache/include/javascript/calendar.js?v=QMfyElAturj9vuK-tY9lzw"></script> | |
<form id="WebToLeadForm" action="http://sugarcrmpgsql-shiruslabs.rhcloud.com/index.php?entryPoint=WebToLeadCapture" method="POST" name="WebToLeadForm"> | |
<table style="border-top-width: 1px; border-top-style: solid; border-bottom-width: 1px; border-bottom-style: solid; padding: 10px 6px 12px 10px; background-color: #e9f3ff; font-size: 12px; width: 100%; background-position: 50% 0%; background-repeat: repeat no-repeat;"> | |
<tbody> | |
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center"> | |
<td colspan="4"> | |
<h2>Web to lead form for Campaign</h2> | |
</td> | |
</tr> | |
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center"> | |
<td colspan="4"> </td> | |
</tr> | |
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="left"> | |
<td colspan="4">Submitting this form will create a lead and link with campaign</td> | |
</tr> | |
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center"> | |
<td colspan="4"> </td> | |
</tr> | |
<tr> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Salutation: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><select id="salutation" name="salutation" tabindex="1"> <option selected="selected" value="">-none-</option> <option value="Mr.">Mr.</option> <option value="Ms.">Ms.</option> <option value="Mrs.">Mrs.</option> <option value="Dr.">Dr.</option> <option value="Prof.">Prof.</option></select></span></td> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Last Name: <span class="required" style="color: #ff0000;">*</span></span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="last_name" type="text" name="last_name" /></span></td> | |
</tr> | |
<tr> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Title: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="title" type="text" name="title" /></span></td> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>First Name: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="first_name" type="text" name="first_name" /></span></td> | |
</tr> | |
<tr> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Email Address: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="email1" type="text" name="email1" onchange="validateEmailAdd();" /></span></td> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Office Phone: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="phone_work" type="text" name="phone_work" /></span></td> | |
</tr> | |
<tr> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Description: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span id="sugarslot"><textarea id="description" type="text" name="description" /> </textarea></span></td> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span> </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span> </span></td> | |
</tr> | |
<tr> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Website: </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="website" type="text" name="website" /></span></td> | |
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span> </span></td> | |
<td style="font-size: 12px; font-weight: normal;" width="35%"><span> </span></td> | |
</tr> | |
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center"> | |
<td colspan="4"> </td> | |
</tr> | |
<tr align="center"> | |
<td colspan="10"><input class="button" onclick="submit_form();" type="button" name="Submit" value="Submit" /></td> | |
</tr> | |
<tr> | |
<td style="display: none;"><input id="campaign_id" type="hidden" name="campaign_id" value="e3184b87-e3a6-7136-4bbd-50b53a1d88a0" /></td> | |
</tr> | |
<tr> | |
<td style="display: none;"><input id="redirect_url" type="hidden" name="redirect_url" value="http://musarra.wordpress.com" /></td> | |
</tr> | |
<tr> | |
<td style="display: none;"><input id="assigned_user_id" type="hidden" name="assigned_user_id" value="seed_will_id " /></td> | |
</tr> | |
<tr> | |
<td style="display: none;"><input id="req_id" type="hidden" name="req_id" value="last_name;" /></td> | |
</tr> | |
</tbody> | |
</table> | |
</form> | |
<script type="text/javascript">// <![CDATA[ | |
function submit_form(){ | |
if(typeof(validateCaptchaAndSubmit)!='undefined'){ | |
validateCaptchaAndSubmit(); | |
}else{ | |
check_webtolead_fields(); | |
} | |
} | |
function check_webtolead_fields(){ | |
if(document.getElementById('bool_id') != null){ | |
var reqs=document.getElementById('bool_id').value; | |
bools = reqs.substring(0,reqs.lastIndexOf(';')); | |
var bool_fields = new Array(); | |
var bool_fields = bools.split(';'); | |
nbr_fields = bool_fields.length; | |
for(var i=0;i<nbr_fields;i++){ | |
if(document.getElementById(bool_fields[i]).value == 'on'){ | |
document.getElementById(bool_fields[i]).value = 1; | |
} | |
else{ | |
document.getElementById(bool_fields[i]).value = 0; | |
} | |
} | |
} | |
if(document.getElementById('req_id') != null){ | |
var reqs=document.getElementById('req_id').value; | |
reqs = reqs.substring(0,reqs.lastIndexOf(';')); | |
var req_fields = new Array(); | |
var req_fields = reqs.split(';'); | |
nbr_fields = req_fields.length; | |
var req = true; | |
for(var i=0;i<nbr_fields;i++){ | |
if(document.getElementById(req_fields[i]).value.length <=0 || document.getElementById(req_fields[i]).value==0){ | |
req = false; | |
break; | |
} | |
} | |
if(req){ | |
document.WebToLeadForm.submit(); | |
return true; | |
} | |
else{ | |
alert('Please provide all the required fields'); | |
return false; | |
} | |
return false | |
} | |
else{ | |
document.WebToLeadForm.submit(); | |
} | |
} | |
function validateEmailAdd(){ | |
if(document.getElementById('email1') && document.getElementById('email1').value.length >0) { | |
if(document.getElementById('email1').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){ | |
alert('Not a valid email address'); | |
} | |
} | |
if(document.getElementById('email2') && document.getElementById('email2').value.length >0) { | |
if(document.getElementById('email2').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){ | |
alert('Not a valid email address'); | |
} | |
} | |
} | |
// ]]></script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment