I have successfully integrated the WebToLead form with my wordpress site with one terrible exception. The email address is not being collected. What I did was
- Created a web to lead form with Sugar tool
- saved and opened this html file in dreamweaver and stripped out anything style related
- Created a new php 'Page' template and saved it to the WP Themes
Everything works great except the email isn't being captured. I'm sure this has somethign to do with the fact that the email is validated and then probably passed to the post by javascript - I don't know I'm stumped. I've tried moving the javascript around the page, in the head etc, still no dice.
This is a link to a (mostly) functional form page that I posted http://www.provestre.com/investment-...roperty-videos
I've pasted the code from the page below, I hope that's not in poor taste for this forum.
<?php
/*
Template Name: 2-4Unit
*/
?>
<?php include('header_about.php'); ?>
<head>
<script charset="utf-8" id="injection_graph_func" src="WebToLeadForm_Videos_1202071505_files/injection_graph_func.js">
</script>
</head>
<div id="content_box">
<div id="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 style="padding-top: 0;"><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<div class="entry">
<!-- base href="http://crm.provestre.net/cache/generated_forms/WebToLeadForm_1202071505.html" -->
<form action="http://crm.provestre.net/WebToLeadCapture.php" name="WebToLeadForm" method="post">
<table width="510">
<tbody>
<tr>
<td colspan="4"><b>
<h2>Get more information about these properties</h2>
</b></td>
</tr>
<tr align="center">
</tr>
<tr align="left">
<td colspan="4">Complete this form and we'll get property details to you right away including addresses, financials, and more </td></tr>
<tr align="center"><td colspan="4"> <br></td></tr>
<tr>
<td width="15%"><span sugar="slot">First Name: </span></td>
<td width="35%">
<span sugar="slot">
<input id="first_name" name="first_name" type="text"></span></td>
</tr>
<tr>
<td width="15%">
<span sugar="slot">Last Name: </span>
<span class="required" style="color: rgb(255, 0, 0);">*</span></td>
<td width="35%">
<span sugar="slot">
<input id="last_name" name="last_name" type="text"></span></td>
</tr><tr><td width="15%">
<span sugar="slot">Email: <span class="required" style="color: rgb(255, 0, 0);">*</span></span></td><td width="35%">
<span sugar="slot"><input id="webtolead_email1" name="webtolead_email1" onChange="validateEmailAdd();" type="text"></span></td>
</tr>
<tr><td width="15%">
<span sugar="slot">Phone: </span></td><td width="35%"><span sugar="slot">
<input id="phone_work" name="phone_work" type="text"></span></td>
</tr>
<tr>
<td width="15%"><span sugar="slot">Property: </span></td>
<td width="35%"><span sugar="slot"><input id="description" name="description" type="text"></span></td>
</tr>
<tr>
<td width="15%"><span sugar="slot"> </span><br></td>
<td width="35%"><span sugar="slot"> </span><br></td></tr>
<tr align="center">
<td colspan="4"> <br></td></tr>
<tr align="center">
<td colspan="10">
<input onClick="check_webtolead_fields();" class="button" name="Submit" value="Submit" type="button"></td></tr>
<tr><td style="display: none;">
<input id="campaign_id" name="campaign_id" value="29aa52af-9e29-38a9-6f51-47a626830de7" type="hidden"><br></td></tr><tr><td style="display: none;">
<input id="redirect_url" name="redirect_url" value="http://www.provestre.com/request-confirmation" type="hidden"><br></td></tr><tr><td style="display: none;">
<input id="bs_lead_type_c" name="bs_lead_type_c" value="buyer" type="hidden" /><br></td></tr><tr><td style="display: none;">
<input id="assigned_user_id" name="assigned_user_id" value="a1a01f81-ed07-b564-d425-4773b7f3911d" type="hidden"><br></td></tr><tr><td style="display: none;">
<input id="req_id" name="req_id" value="last_name;" type="hidden"><br></td>
</tr>
</tbody>
</table>
</form>
<div>
<script type="text/javascript">
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').val ue.length >0) {
if(document.getElementById('webtolead_email1').val ue.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
alert('Not a valid email address');
}
}
if(document.getElementById('webtolead_email2').val ue.length >0) {
if(document.getElementById('webtolead_email2').val ue.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/) == null){
alert('Not a valid email address');
}
}
}
</script>
</div>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
</div>
</div>
<?php endwhile; endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks