Thanks for the assist, Sandy. I remember seeing the String value="yes" attribute for the checkbox input type when looking at the code but overlooked that. Good to know what I should be doing on my end going forward.
// Find the button element that you want to Unsubscribe
var Unsub = document.getElementById("UnsubBtn");
Unsub.onclick = function() {
// Change button text to say Please wait... (this is to mirror the action of the standard submit button)
Unsub.style.cssText = 'opacity: .5; filter: alpha(opacity=50); /* IE8 and lower */';
Unsub.innerHTML = 'Hold yer horses...';
// When the button is clicked, get the form object and submit it
MktoForms2.whenReady(function (form) {
// Set the values of subscription fields to No and Unsubscribe to Yes for Checkbox Input Type
form.vals({ "pWRUnsubscribedfromall":"yes","pWROptCareersInPOWER":"no","pWROptAdvertisingSponsorshipOpportunities":"no"});
// Submit the Form
form.submit();
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "http://lp.powermag.com/Unsubscribe.html";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
});
};
// Find the button element that you want to Subscribe
var Sub = document.getElementById("SuballBtn");
Sub.onclick = function() {
// Change button text to say Please wait... (this is to mirror the action of the standard submit button)
Sub.style.cssText = 'opacity: .5; filter: alpha(opacity=50); /* IE8 and lower */';
Sub.innerHTML = 'Just a moment...';
// When the button is clicked, get the form object and submit it
MktoForms2.whenReady(function (form) {
// Set the values of subscription fields to Yes and Unsubscribe to No for Checkbox Input Type
form.vals({ "pWRUnsubscribedfromall":"no","pWROptCareersInPOWER":"yes","pWROptAdvertisingSponsorshipOpportunities":"yes"});
// Submit the Form
form.submit();
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "http://lp.powermag.com/Preference-Update.html";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
});
};