Last active
September 19, 2015 21:48
-
-
Save hiddenpearls/b4a18a39631a464877b4 to your computer and use it in GitHub Desktop.
Adding a Checkbox in Hubspot forms in a hackable way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbspt.forms.create({ | |
portalId: '1234567', | |
formId: 'formid-here', | |
css: 'select{font-size:21px;line-height:36px;background: #0397d6;font-family:"ProximaNova-Regular";height: 36px;color: #fff;position: relative;box-shadow: 0 3px 5px rgba(0,0,0,.20);-moz-box-shadow: 0 3px 5px rgba(0,0,0,.20);-webkit-box-shadow: 0 3px 5px rgba(0,0,0,.20);border-radius: 5px;-moz-border-radius: 5px;-webkit-border-radius:5px;margin-bottom:11px;border:0;width: 100%;}select:focus{outline:none} label{display:none;}.fldSet4 input[type="text"], .fldSet4 input[type="email"]{font-size: 16px;} .input select{font-size: 16px;}', | |
onFormReady: function($form) { | |
$form.on('change', '#form_policy', function(){ | |
if(jQuery(this).is(':checked')){ | |
jQuery("#policy_wrap").stop(true,true).slideUp('slow'); | |
} | |
}); | |
}, | |
onBeforeValidationInit: function($form){ | |
$form.on('submit', function() { | |
if(jQuery('#form_policy').is(":checked")) { | |
return true; | |
}else{ | |
jQuery("#policy_wrap").remove(); | |
jQuery("<div id=\"policy_wrap\"></div>").insertAfter("#hsForm_id1 .hs_what_is_your_interest"); | |
jQuery("#policy_wrap").html('').show(); | |
jQuery("#policy_wrap").stop(true,true).slideDown('slow'); | |
jQuery("<div class=\"popup_background\"></div><div class=\"popup_data\"><p><input type=\"checkbox\" value=\"Yes\" name=\"form_policy\" id=\"form_policy\" />Lorum Ipsum Agreement text comes here.</div>").appendTo("#policy_wrap"); | |
return false; | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment