Newsletters
What matters now and why
Get news and insights—plus exclusive content, offers, and more. Make your selection, then fill out the form below.
We protect your privacy.
I would like to receive email updates from O’Reilly on its latest ideas, events, and offers. \n ';
if (requiresConsent(country) && gdprConsentHidden(gdprSelect)) {
gdprSelect.classList.toggle('hidden');
gdprSelect.innerHTML = optInHtml;
} else if (!requiresConsent(country) && !gdprConsentHidden(gdprSelect)) {
gdprSelect.classList.toggle('hidden');
gdprSelect.innerHTML = '';
}
}
function requiresConsent(country) {
var euCountries = ['Austria', 'Belgium', 'Bulgaria', 'China', 'Croatia', 'Republic of Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland', 'Italy', 'Latvia', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Malta', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Romania', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'United Kingdom'];
return(euCountries.indexOf(country) + 1);
}
function gdprConsentHidden(gdprSelect) {
return gdprSelect.classList.contains('hidden') ? true : false;
}
function verif(formName) {
const formId = '#marketingCloudForm';
const form = document.getElementById('marketingCloudForm');
//Loop through each previous error and remove the class and aria-invalid attribute
const errorItems = document.querySelectorAll('#marketingCloudForm .error');
errorItems.forEach(function(item) {
item.classList.remove('error');
item.removeAttribute('aria-invalid');
});
var errors = [];
//Loop through each required field
const requiredFields = document.querySelectorAll('#marketingCloudForm [aria-required$="true"]');
requiredFields.forEach(function(field) {
if (fieldInvalid(field, form)) {
createError(field, '#marketingCloudForm', 'marketingCloudForm', errors);
};
});
// If errors found, display them and prevent submit
if (errors.length > 0) {
displayErrors(errors);
return false;
}
// When no errors found continue...
// Push dataLayer event for Goggle Analytics
var emailTopic = '';
if (document.getElementById('marketingCloudForm').elements['NewsletterTopic'] != undefined) {
emailTopic = document.getElementById('marketingCloudForm').elements['NewsletterTopic'].value.toLowerCase();
}
dataLayer.push({
'event': 'eventTracker',
'eventCat':'email sign up',
'eventAct':'topic sign up',
'eventLbl': emailTopic,
'eventVal':0,
'nonInteraction':0
});
return true;
//return false;
}
function fieldInvalid(field, form) {
if (field.tagName === 'FIELDSET') {
return (consentInvalid(field, form)) ? true : false;
} else if (field.name === "email") {
return (emailInvalid(form)) ? true : false;
} else {
return (field.value.length < 1) ? true : false;
}
}
function consentInvalid(field, form) {
if (form.elements['Marketing_Consent'].value.length < 1) {
//form.elements['Marketing_Consent'].value = form.elements['consent'].value;
return true;
}
}
function emailInvalid(form) {
var mail = new RegExp('@+','g');
if ( (form.email.value.length < 1) || (!mail.test(form.email.value)) ) {
return true;
}
}
function createError(field, formId, formName, errors) {
if (field.tagName === 'fieldset') {
field.classList.add('error');
} else {
field.classList.add('error');
field.setAttribute('aria-invalid','true');
}
errors.push(field.dataset.text);
}
function displayErrors(errors) {
var errorMessage = '';
if (errors.length > 3) {
errorMessage = ' Please fill out all required fields.';
}
else {
errorMessage = ' Please enter your ';
for (i = 0; i < errors.length; i++) {
errorMessage += errors[i];
if (i === errors.length - 2) {
errorMessage += ', and '
}
else if (i < errors.length - 1) {
errorMessage += ', '
}
else {
errorMessage += '.'
}
}
}
document.getElementById('marketingCloudForm-errorMessage').innerHTML = errorMessage;
}