Opt-in checkboxes – Cordial Knowledge Base
How can we help?
Overview
Follow these steps to have opt-in checkbox selected by default.
Select opt-in checkbox by default
- On top right select Name or Account name in Web Forms interface.
- Select Custom JavaScript.
- Paste the following custom JavaScript in the correct places.
This will make the opt-in checkbox selected by default across all lightboxes in the account.
In before lightbox display
//Auto-check opt-in checkbox
var iframe = document.getElementById(“lightbox - iframe - ” +lbid);
if (iframe !== null) {
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) {
var iframeOptIn = iframeDocument.getElementById(‘form_input_opt_in’);
if (iframeOptIn) {
iframeOptIn.checked = PRIMER_CUSTOM_JS_GLOBAL.precheck_checkbox;
}
}
}
In after lightbox display
//Auto-check opt-in checkbox
var iframe = document.getElementById(“lightbox-iframe-” + lbid);
if (iframe !== null) {
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDocument) {
var iframeOptIn = iframeDocument.getElementById(‘form_input_opt_in’);
if (iframeOptIn) {
iframeOptIn.checked = PRIMER_CUSTOM_JS_GLOBAL.precheck_checkbox;
}
}
}