Hey guys,
I’ve created a form in webflow which I’ve added custom attributes to each field, form and body & header tags in order to allow submissions to be sent to ZOHO CRM including hidden lead source fields.
I think I’ve got everything in the right places although when I try to submit a form nothing happens and i get these console error messages (via chrome):
is there something wrong with my before script? I’m not sure what I’m doing wrong here…
<script>
$(document).ready(function() {
$('select').niceSelect();
});
</script>
<script type='text/javascript' id='VisitorTracking'>var $zoho= $zoho || {};$zoho.salesiq = $zoho.salesiq || {widgetcode:'347cc196f65754773ba4404958a9613f5a08408a801c9a26f6e44beb5ed4bd29376a2706e4d3ab0545049cd87c532af3', values:{},ready:function(){$zoho.salesiq.floatbutton.visible('hide');}};var d=document;s=d.createElement('script');s.type='text/javascript';s.id='zsiqscript';s.defer=true;s.src='https://salesiq.zoho.com/widget';t=d.getElementsByTagName('script')[0];t.parentNode.insertBefore(s,t);function trackVisitor(){try{if($zoho){var LDTuvidObj = document.forms['WebToLeads1399512000007259005']['LDTuvid'];if(LDTuvidObj){LDTuvidObj.value = $zoho.salesiq.visitor.uniqueid();}var firstnameObj = document.forms['WebToLeads1399512000007259005']['First Name'];if(firstnameObj){name = firstnameObj.value +' '+name;}$zoho.salesiq.visitor.name(name);var emailObj = document.forms['WebToLeads1399512000007259005']['Email'];if(emailObj){email = emailObj.value;$zoho.salesiq.visitor.email(email);}}} catch(e){}}</script>
<script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js"></script>
<script type="text/javascript">
jQuery( document ).ready(function() {
xlog = "";
jQuery("#demo-form").validate();
jQuery( "#demo-form" ).submit(function( event ) {
event.preventDefault();
if( jQuery("#demo-form").valid() ) {
//detect if recapcha been trigered already
if(xlog != ""){
console.log("submit action");
document.getElementById("demo-form").submit();
}else{
console.log("prevent action");
grecaptcha.execute();
event.preventDefault();
}
} else {
//report errors
}
});
});
function checkMandatory(token) {
xlog = token;
if( jQuery("#demo-form").valid() ) {
jQuery( "#demo-form" ).submit();
} else {
//report errors
}
}
</script>