WebToLeadForm mandatory fields issues when integrating in wordpress!
Hi,
Im trying to integrate this form within a wordpress and the mandatory fields specified within ZohoCRM but the form gets submitted successfully without validating the forms.
When i proceed a test within a plain HTML page ... the form works perfectly but not when integrating in the wordpress template:
http://www.purerelocation.co.uk/call-me-back/
Please find the embedded codes as follows:
<div id='crmWebToEntityForm' class="onesc">
<META HTTP-EQUIV ='content-type' CONTENT='text/html;charset = UTF-8'>
<form action='https://crm.zoho.com/crm/WebToLeadForm' name=WebToLeads194976000000192003 method='POST' onSubmit='javascript:document.charset="UTF-8"; return checkMandatery()' accept-charset='UTF-8'>
<input type='hidden' name='xnQsjsdp' value=ZmSRoAbm2KM$/>
<input type='hidden' name='xmIwtLD' value=RfrAVyhicOzQyR4vSEt-oiDPfpWe20lJ/>
<input type='hidden' name='actionType' value=TGVhZHM=/> <input type='hidden' name='returnURL' value='http://www.purerelocation.co.uk/call-me-back-confirmation/' /> <br>
<p>First Name*</p><input maxlength="40" name="First Name" size="20" type="text" />
<p>Last Name*</p><input maxlength="80" name="Last Name" size="20" type="text" />
<p>Email Address*</p><input maxlength="100" name="Email" size="20" type="text" />
<p>Phone*</p><input type='text' maxlength='30' name='Phone' /><br/>
<p>I Understand The Terms & Conditions </p><input type='checkbox' name='LEADCF102' /><br/>
<input type="submit" name="save" value="Submit" class="request"><br/><br/>
<script>
var mndFileds=new Array('First Name','Last Name','Email','Phone','LEADCF102');
var fldLangVal=new Array('First Name','Last Name','Email','Phone','I Understand The Terms & Conditions');
function checkMandatery(){
for(i=0;i<mndFileds.length;i++){
var fieldObj=document.forms['WebToLeads194976000000192003'][mndFileds[i]];
if((fieldObj) && ((fieldObj.value).replace(/^\s+|\s+$/g, '')).length==0){
alert(fldLangVal[i] +' cannot be empty');
fieldObj.focus();
return false;
}
else if(fieldObj && (fieldObj.nodeName=='SELECT') && (fieldObj.options[fieldObj.selectedIndex].value=='-None-')){
alert(fldLangVal[i] +' cannot be none');
fieldObj.focus();
return false;
}
else if(fieldObj.type =="checkbox" && fieldObj.checked == false){
alert("Please accept Terms & Conditions ");
fieldObj.focus();
return false;
}
}
}
</script>
</form>
<p style="clear:both;"></p>
</form>
</div>
<br/>
<p><strong>Terms & Conditions</strong><br/>
By submitting this form you are agreeing that ... </p>
<br/>