function createCookieFSS(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } jQuery(function() { // Set Form Action to a real one: // jQuery('#ha_ifs_free_signup_form').attr('action', 'https://rz126.infusionsoft.com/app/form/process/858104c0296337683998b47c44d70734'); jQuery('#ha_ifs_free_signup_form').attr('action', 'https://rz126.infusionsoft.com/app/form/process/6edb1e7f0d7572796bf64a85b44892da'); jQuery('#ha_ifs_free_signup_form').append(''); // Verify market ids // jQuery('#ha_ifs_free_signup_form').submit(function() { jQuery('#ha_ifs_free_signup_form').submit(function() { /* if (jQuery('#inf_custom_MemberLocation1').val() == null || jQuery('#inf_custom_MemberLocation1').val() == "" || jQuery('#inf_custom_MemberLocation1').val().indexOf('msa_') != 0) { console.log("Form Incomplete [CODE_FER12]"); alert("Please Select at leat one state"); return false; } */ jQuery('[data-js="fss-popup-content"]').fadeOut(300,function(){ jQuery('[data-js="fss-form-thank-you-block"]').fadeIn(300); }); return true; }); // Save form selection to cookies: jQuery("#ha_ifs_free_signup_form input").on('keyup paste', function() { fss_form_save_to_cookies(); }); jQuery("#ha_ifs_free_signup_form select").on('change', function() { fss_form_save_to_cookies(); }); const urlParams = new URLSearchParams(window.location.search); if (typeof(urlParams.get('email')) != 'undefined') { jQuery("#inf_field_Email").val(urlParams.get('email')); } }); function fss_showhide_facebook_button() { // if (jQuery("#inf_custom_MemberLocation1").val() != null && jQuery("#inf_field_FirstName").val() != '' && jQuery("#inf_field_LastName").val() != '' && jQuery("#inf_field_Phone1").val() != '' ) { if (jQuery("#inf_field_FirstName").val() != '' && jQuery("#inf_field_LastName").val() != '' && jQuery("#inf_field_Phone1").val() != '' ) { jQuery("#FSS-Complete").show(); jQuery("#FSS-Incomplete").hide(); } else { jQuery("#FSS-Complete").hide(); jQuery("#FSS-Incomplete").show(); } } function fss_form_save_to_cookies() { fss_showhide_facebook_button(); var fields_to_save = [ // 'inf_custom_MemberLocation1', // 'inf_custom_MemberLocation2', // 'inf_custom_MemberLocation3', 'inf_field_FirstName', 'inf_field_LastName', 'inf_field_Phone1', 'inf_field_Email' ]; var form_data = {}; for (var index in fields_to_save) { var field_id = fields_to_save[index]; if (typeof(field_id) == "string") { form_data[field_id] = jQuery("#" + field_id).val(); } } json_str = JSON.stringify(form_data); // console.log(json_str); createCookieFSS('fss_form_data',json_str,1); }