Web to lead SugarCRM

marcielo 16 Feb, 2010
Hi there

I've been trying to make this work before without luck:
http://chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=15633&p=39368&hilit=sugar#p39368

But I came around another way to make this to work, maybe. SugarCRM has a way to autogenerate web-to-lead forms. I was able to copy and paste the form code into a joomla article and the form worked just fine.
But unfortunately I love chronoforms🙂 and it isn't as straight forward as I hoped.

I tried to strip the code below from javascript tags and inserted it in the second box. I tried different approaches but I couldn't make it work.

The Javascript is placed before and after the form:


<link href="http://www.crm.mysite.com/themes/SugarLite/calendar-win2k-cold-1.css?s=1dab2a7994fe0b046b99e681a496e753&c=1" rel="stylesheet" type="text/css" media="all" mce_href="themes/SugarLite/calendar-win2k-cold-1.css?s=1dab2a7994fe0b046b99e681a496e753&c=1">

<script src="http://www.crm.mysite.com/include/javascript/sugar_grp1.js?s=1dab2a7994fe0b046b99e681a496e753&c=1" type="text/javascript" language="Javascript"></script>

<script src="http://www.crm.mysite.com/jscalendar/lang/calendar-da.js?s=1dab2a7994fe0b046b99e681a496e753&c=1" type="text/javascript" mce_src="jscalendar/lang/calendar-da.js?s=1dab2a7994fe0b046b99e681a496e753&c=1"></script>

<form action="http://crm.mysite.com/index.php?entryPoint=WebToLeadCapture" name="WebToLeadForm" method="POST" id="WebToLeadForm">
<table class="mceVisualAid" style="border-top: 1px solid; border-bottom: 1px solid; padding: 10px 6px 12px 10px; background-color: rgb(233, 243, 255); font-size: 12px; background-repeat: repeat-x; background-position: center top;" width="100%"><tbody><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center"><td class="mceVisualAid" colspan="4"><b><h2>hh</h2></b></td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center"><td class="mceVisualAid" colspan="4"> </td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="left"><td class="mceVisualAid" colspan="4">Afsendelse af denne formular vil oprette et emne og et link til kampagnen</td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center"><td class="mceVisualAid" colspan="4"> </td></tr><tr><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Efternavn: </span><span class="required" style="color: rgb(255, 0, 0);">*</span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="last_name" name="last_name" type="text"></span></td><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Hvem er opgaven fra?: </span><span class="required" style="color: rgb(255, 0, 0);">*</span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><select id="hvem_er_opgaven_fra_c" name="hvem_er_opgaven_fra_c" tabindex="1">
<option selected="selected" value="vaelg">Vælg</option>
<option value="Boligejer">Boligejer</option>
<option value="Boligforening">Boligforening</option>
<option value="off institutioner">Off. institutioner</option>
<option value="Virksomhed">Virksomhed</option></select></span></td><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Hvor har du hørt om mysite.com?: </span><span class="required" style="color: rgb(255, 0, 0);">*</span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><select id="hvor_har_du_hoert_om_energibol_c" name="hvor_har_du_hoert_om_energibol_c" tabindex="1">
<option selected="selected" value="vaelg">Vælg</option>
<option value="venner_bekendte">Venner/bekendte</option>
<option value="raadgiver">Rådgiver</option>
<option value="soegemaskiner">Søgemaskiner</option>
<option value="internettet">Internettet</option>
<option value="pressen">Pressen</option>
<option value="annoncer_messe">Annoncer/messer</option></select></span></td><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Efteriolsering: </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="efteriolsering_c_LOFT / SKUNK / SKRÅVÆG" name="radio_grp_efteriolsering_c" value="LOFT / SKUNK / SKRÅVÆG" type="radio"><span array_loft="" skunk="" skrÅvÆg="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">LOFT / SKUNK / SKRÅVÆG</span><br /><input id="efteriolsering_c_HULMUR" name="radio_grp_efteriolsering_c" value="HULMUR" type="radio"><span array_hulmur="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">HULMUR</span><br /><input id="efteriolsering_c_YDERVÆG / FACADE" name="radio_grp_efteriolsering_c" value="YDERVÆG / FACADE" type="radio"><span array_ydervÆg="" facade="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">YDERVÆG / FACADE</span><br /><input id="efteriolsering_c_KÆLDER" name="radio_grp_efteriolsering_c" value="KÆLDER" type="radio"><span array_kÆlder="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">KÆLDER</span><br /><input id="efteriolsering_c_VARMERØR / KEDEL" name="radio_grp_efteriolsering_c" value="VARMERØR / KEDEL" type="radio"><span array_varmerØr="" kedel="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">VARMERØR / KEDEL</span><br /><input id="efteriolsering_c_GULVISOLERING" name="radio_grp_efteriolsering_c" value="GULVISOLERING" type="radio"><span array_gulvisolering="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">GULVISOLERING</span><br /><input id="efteriolsering_c_ANDET INDEN FOR ISOLERING" name="radio_grp_efteriolsering_c" value="ANDET INDEN FOR ISOLERING" type="radio"><span array_andet="" inden="" for="" isolering="" ).checked="true" style="cursor: default;" ;="" onmousedown="return false;">ANDET INDEN FOR ISOLERING</span><br /></span></td><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td class="mceVisualAid" style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td class="mceVisualAid" style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center"><td class="mceVisualAid" colspan="4"> </td></tr><tr align="center"><td class="mceVisualAid" colspan="10"><input onclick="submit_form();" class="button" name="Submit" value="Send" type="button"></td></tr><tr><td class="mceVisualAid" style="display: none;"><input id="campaign_id" name="campaign_id" value="cc4f94a8-b8dc-8f83-7e19-4b6945e1d739" type="hidden"></td></tr><tr><td class="mceVisualAid" style="display: none;"><input id="assigned_user_id" name="assigned_user_id" value="3ea1a7b0-2110-f16b-4e85-4a93d2327919" type="hidden"></td></tr><tr><td class="mceVisualAid" style="display: none;"><input id="req_id" name="req_id" value="last_name;hvem_er_opgaven_fra_c;hvor_har_du_hoert_om_energibol_c;" type="hidden"></td></tr></tbody>
</table>
</form>

<script type="text/javascript">
 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('Vær venlig at udfylde alle de krævede felter');
          return false;
         }
        return false
   }
   else{
    document.WebToLeadForm.submit();
   }
}
function validateEmailAdd(){
	if(document.getElementById('webtolead_email1').value.length >0) {
		if(document.getElementById('webtolead_email1').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
		  alert('Ugyldig e-mailadresse');
		}
	}
	if(document.getElementById('webtolead_email2').value.length >0) {
		if(document.getElementById('webtolead_email2').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
		  alert('Ugyldig e-mailadresse');
		}
	}
}
</script>


What approach should I take?
GreyHead 16 Feb, 2010
Hi Marcielo,

If you remove the <form . .> and </form> tags and put http://crm.mysite.com/index.php?entryPoint=WebToLeadCapture in the form OnSubmit box then it should work OK in ChronoForms. It will submit directly to SugarCRM and ChronoForms won't see the results.

A little neater is to tidy up the code. Put the part between the Form tags in the Form HTML box; part between the script tags in the Form JavaScript box; and add this to the Form HTML to load the scripts
<?php
if ( !$mainframe->isSite() ) {return; }
$doc =& JFactory::getDocument();
$doc->addStyleSheet('http://www.crm.mysite.com/themes/SugarLite/calendar-win2k-cold-1.css?s=1dab2a7994fe0b046b99e681a496e753&c=1');
$doc->addScript('http://www.crm.mysite.com/include/javascript/sugar_grp1.js?s=1dab2a7994fe0b046b99e681a496e753&c=1');
$doc->addScript('http://www.crm.mysite.com/jscalendar/lang/calendar-da.js?s=1dab2a7994fe0b046b99e681a496e753&c=1');
?>

Bob
MichaelBode 08 Mar, 2010
I am having the same issues but I can't seem to get the thing to work in either case. I have tried sectioning off the javascript and html as you stated. I added the php reference to include the external javascript code. However, when I get to the document.WebtoLead.submit() call, execution just stops. For instance, I don't get the alert ("submit done") call. I also don't get an email nor do I get a sugarcrm lead record.

I have attempted to also setup using CURL to the same result. It is not clear whether Sugar's webtolead form even supports CURL as all their documentation states they use SOAP but the index is PHP. Anyway, I don't care whether it is by POST or by CURL (though preferred), I just need to get it to work.

Any help you can lend would be great. I would be happy to give you creds if you just want to get in and take a look at what I am doing.

Here are the details of my attempt:

Submit URL:
http://mydomain.com/crm/index.php?entryPoint=WebToLeadCapture


Form HTML:
<?php
$user =& JFactory::getUser();
if ( !$mainframe->isSite() ) {return; }
$doc =& JFactory::getDocument();
$doc->addStyleSheet('http://mydomain.com/crm/themes/SugarLite/calendar-win2k-cold-1.css?s=df5a186719d17b86299cfae032bb40ee&c=1');
$doc->addScript('http://mydomain.com/crm/jscalendar/lang/calendar-en.js?s=df5a186719d17b86299cfae032bb40ee&c=1');
$doc->addScript('http://mydomain.com/crm/include/javascript/sugar_grp1.js?s=df5a186719d17b86299cfae032bb40ee&c=1');

$user =& JFactory::getUser();
?>
First Name:<br>
<input id="first_name" name="first_name" value="<?PHP echo $user->name;?>" type="text"><br>

Last Name:<br>
<input id="last_name" name="last_name" type="text">

Account Name:<br>
<input id="account_name" name="account_name" type="text">

<input type="button" onclick="submit_form();" class="button" name="Continue" value="Continue">

<input type="hidden" id="campaign_id" name="campaign_id" value="8e9edb54-4017-185a-ff2d-4b8e67dd4f50">
<input type="hidden" id="assigned_user_id" name="assigned_user_id" value="1">
<input type="hidden" id="req_id" name="req_id" value="last_name;">


Form Javascript:
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){
alert("Submit start");
                document.WebToLeadForm.submit();
alert("Submit done");
            return true;
        }
        else{
          alert('Please provide all the required fields');
          return false;
         }
        return false
   }
   else{
    document.WebToLeadForm.submit();
   }
}
function validateEmailAdd(){
	if(document.getElementById('webtolead_email1').value.length >0) {
		if(document.getElementById('webtolead_email1').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
		  alert('Not a valid email address');
		}
	}
	if(document.getElementById('webtolead_email2').value.length >0) {
		if(document.getElementById('webtolead_email2').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
		  alert('Not a valid email address');
		}
	}
}
geocentricdesign 06 Apr, 2010
Any luck on this? I'm trying to do the same thing, use custom code from SugarCRM's web to lead form generator to submit directly to SugarCRM. I've tried CURL and ReDirect plugins on the mother form but neither seems to pull in the variables from the previous child posts. At the end I get a confirmation page but the info never reaches SugarCRM (which is on the same server BTW). I've tried everything. Can someone just log into my site and take a look at the settings? It would take way too long to explain everything in words. PM me if you can help. Thanks!
craig 06 May, 2010
I am also having trouble with linking to Sugar. After reading this forum, I separated the java script from HTML and added it to the java window and added the submit destination to the submit window - the form looks perfect... the submit button does not work! <<btw when i inserted the form in an article it would only work in preview mode, even with the editor turned off, once it was saved the submit would not work - i am using the JCE Editor>>

HTML Code looks like this:

<p><link rel="stylesheet" type="text/css" media="all" href="?s=b04a5a3fc30e984807f478eabc723fcd&c=1" href="?s=b04a5a3fc30e984807f478eabc723fcd&c=1"></p><form action="http://crm1.busyworker.be/index.php?entryPoint=WebToLeadCapture" name="WebToLeadForm" method="POST" id="WebToLeadForm"><table class="mceItemTable" style="border-top: 1px solid; border-bottom: 1px solid; padding: 10px 6px 12px 10px; background-color: rgb(233, 243, 255); font-size: 12px; background-repeat: repeat-x; background-position: center top;" mce_style="border-top: 1px solid;
border-bottom: 1px solid;
padding: 10px 6px 12px 10px;
background-color: #e9f3ff;
font-size: 12px;
background-repeat: repeat-x;
background-position: center top;" width="100%"><tbody><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" mce_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"><b><h2>Web to lead form for Campaign</h2></b></td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" mce_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: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" mce_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: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" mce_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;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">First Name: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="first_name" name="first_name" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Last Name: </span><span class="required" style="color: rgb(255, 0, 0);" mce_style="color: #ff0000;">*</span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="last_name" name="last_name" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Primary Address Street: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="primary_address_street" name="primary_address_street" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Primary Address City: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="primary_address_city" name="primary_address_city" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Primary Address State: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="primary_address_state" name="primary_address_state" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Primary Address Postalcode: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="primary_address_postalcode" name="primary_address_postalcode" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Home Phone: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="phone_home" name="phone_home" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot">Email Address: </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"><input id="webtolead_email1" name="webtolead_email1" onchange="validateEmailAdd();" type="text"></span></td><td style="text-align: left; font-size: 12px; font-weight: normal;" mce_style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span sugar="slot"> </span></td><td style="font-size: 12px; font-weight: normal;" mce_style="font-size: 12px; font-weight: normal;" width="35%"><span sugar="slot"> </span></td></tr><tr style="color: rgb(0, 105, 225); font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" mce_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 onclick="submit_form();" class="button" name="Submit" value="Submit" type="button"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="campaign_id" name="campaign_id" value="d36f0d5b-8f61-836c-afc8-4bdf2d072fb4" type="hidden"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="redirect_url" name="redirect_url" value="http://landdiva.com/index.php/our-events" type="hidden"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="assigned_user_id" name="assigned_user_id" value="cfacf056-632b-1d37-4770-4bdf40e88f1f" type="hidden"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="team_id" name="team_id" value="ead404c6-b9f8-d2a0-77e6-4bdf40406edb" type="hidden"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="team_set_id" name="team_set_id" value="Michelle Shaman" type="hidden"></td></tr><tr><td style="display: none;" mce_style="display: none"><input id="req_id" name="req_id" value="last_name;" type="hidden"></td></tr></tbody></table></form><p></p>


Java Script:
src="include/javascript/sugar_grp1.js?s=b04a5a3fc30e984807f478eabc723fcd&c=1" src="include/javascript/sugar_grp1.js?s=b04a5a3fc30e984807f478eabc723fcd&c=1"
src="jscalendar/lang/calendar-en.js?s=b04a5a3fc30e984807f478eabc723fcd&c=1" src="jscalendar/lang/calendar-en.js?s=b04a5a3fc30e984807f478eabc723fcd&c=1"
 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('webtolead_email1').value.length >0) {
		if(document.getElementById('webtolead_email1').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
		  alert('Not a valid email address');
		}
	}
	if(document.getElementById('webtolead_email2').value.length >0) {
		if(document.getElementById('webtolead_email2').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/) == null){
		  alert('Not a valid email address');
		}
	}
}


Submit :
"http://crm1.busyworker.be/index.php?entryPoint=WebToLeadCapture"


I hope you're able to help, I am getting frustrated!
GreyHead 06 May, 2010
Hi Craig,

That HTML code has <form. . .> tags in it. ChronoForms will add itens own form tags and nested form tags will break the form.

Stripping out all the guff what you actually have in terms of form code is this
<h2>Web to lead form for Campaign</h2>
Submitting this form will create a lead and link with campaign
First Name: <input id="first_name" name="first_name" type="text">
Last Name: <input id="last_name" name="last_name" type="text">
Primary Address Street: <input id="primary_address_street" name="primary_address_street" type="text">
Primary Address City: <input id="primary_address_city" name="primary_address_city" type="text">
>Primary Address State: <input id="primary_address_state" name="primary_address_state" type="text">
Primary Address Postalcode: <input id="primary_address_postalcode" name="primary_address_postalcode" type="text">
Home Phone: <input id="phone_home" name="phone_home" type="text">
Email Address: <input id="webtolead_email1" name="webtolead_email1" class="validate-email" type="text">

Put this in the Form HTML box, then enable the cURL plugin and add the corresponding entries in the 'Input names from your form' boxes there.

The hidden field values (and the query string from the URL) can go in the 'Extra values to send box as
campaign_id=d36f0d5b-8f61-836c-afc8-4bdf2d072fb4
redirect_url=http://landdiva.com/index.php/our-events
assigned_user_id=cfacf056-632b-1d37-4770-4bdf40e88f1f
team_id=ead404c6-b9f8-d2a0-77e6-4bdf40406edb
team_set_id=Michelle Shaman
req_id=last_name
entryPoint=WebToLeadCapture


Lastly put the submit url http://crm1.busyworker.be/index.php in the cURL Params 'Target URL' box

Now enable the plugin in the From Editor plugins tab (green bar is enabled) and test and with luck it will work OK.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger