console.log('its running'); var form = ""; $(document).ready(function(){ form = document.getElementById('lead-node-form'); }); function processForm(e) { if (e.preventDefault) e.preventDefault(); console.log('processing'); var fieldsOK = true; //reset border colors in case were wrong last time $('#edit-field-living-preference-und').removeClass('invalid-field'); $('#edit-field-bathrooms-lead-und').removeClass('invalid-field'); $('#edit-field-lead-how-much-month-und-0-value').removeClass('invalid-field'); $('#edit-field-lead-validate-und-0-value').removeClass('invalid-field'); if(($('#edit-field-living-preference-und').val() == undefined)){ fieldsOK = false; $('#edit-field-living-preference-und').addClass('invalid-field'); console.log('bad living preferce location'); } if($('#edit-field-bathrooms-lead-und').val() == '_none'){ console.log('bathroom bad'); fieldsOK = false; $('#edit-field-bathrooms-lead-und').addClass('invalid-field'); } if($('#edit-field-lead-how-much-month-und-0-value').val() == ""){ console.log('monthly rate bad'); fieldsOK = false; $('#edit-field-lead-how-much-month-und-0-value').addClass('invalid-field'); } if($('#edit-field-lead-validate-und-0-value').val().toLowerCase() != 'person'){ console.log('spam alert'); fieldsOK = false; $('#edit-field-lead-validate-und-0-value').addClass('invalid-field'); } if(fieldsOK == false){ alert('please correct the errors'); return false; } $('#continue-background').css('z-index',"999999999"); $('#continue-background').show(0); console.log('shown'); /* do what you want with the form */ setTimeout(function(){ console.log('doing submit'); form.submit(); }, 2000); _gaq.push(['_trackEvent', 'form', 'submit', 'zoom']); // You must return false to prevent the default form behavior return false; } if (form.attachEvent) { form.attachEvent("submit", processForm); } else { form.addEventListener("submit", processForm); } $('#form-submit').click(function(){ /*var fname = $('#edit-field-lead-name') var lname = $('#edit-field-last-name') var email = $('#edit-field-lead-email') var phone = $('#edit-field-lead-phone') fname.removeClass('invalid-field'); lname.removeClass('invalid-field'); email.removeClass('invalid-field'); phone.removeClass('invalid-field'); if(fname.val() == "") fname.addClass('invalid-field'); if(lname.val() == "") lname.addClass('invalid-field'); if(email.val().substr('@')) email.addClass('invalid-field'); if(phone.val().length < 8) phone.addClass('invalid-field');*/ }); $(document).ready(function(){ $('#zoom-main').append('

Welcome!

Thank you for registering with Zoom

'); $('#continue-background').hide(0); });