New Color logo rsph clear

Digital Transformation in Agribusiness

12th August 2021 — Caroline Carter, RSPH

The agribusiness industry in sub-Saharan Africa faces intense challenges, including constant pressure to meet the demand of feeding a population increasing at 1.2 births per second, and growing safety and environmental concerns.

Companies must balance increasing productivity, efficiency and innovation with the need for socially and environmentally responsible products, including those destined for export to countries with strict regulations.

Stay up to date.

Sign up our newsletter for latest article and news.
document.addEventListener("DOMContentLoaded", function () { // 1. Select all MetForm elements on the page const forms = document.querySelectorAll(".metform-form-content"); forms.forEach(function (form) { form.addEventListener("submit", function (event) { // 2. Find the email input field inside this specific form const emailInput = form.querySelector('input[type="email"]'); if (!emailInput) return; const emailValue = emailInput.value.trim().toLowerCase(); // 3. Define the list of forbidden free email domains const blockedDomains = ["gmail.com", "hotmail.com", "outlook.com", "live.com", "yahoo.com"]; // 4. Extract the domain from the entered email address const emailParts = emailValue.split("@"); if (emailParts.length !== 2) return; const emailDomain = emailParts[1]; // RESTORED: Targets the domain string after the @ // 5. Check if the domain is in our blocked list if (blockedDomains.includes(emailDomain)) { // Prevent the form from submitting to MetForm's servers event.preventDefault(); event.stopPropagation(); // 6. Handle error messaging removeExistingError(form); showErrorMessage(emailInput, "Please use a business email address. Free email providers (Gmail, Hotmail, etc.) are not allowed."); } else { removeExistingError(form); } }, true); // Use capturing phase to intercept MetForm's submit handler early }); // Helper function to inject a clean error message below the input field function showErrorMessage(inputElement, message) { inputElement.style.borderColor = "#ff4d4d"; const errorDiv = document.createElement("div"); errorDiv.className = "metform-custom-error"; errorDiv.innerText = message; errorDiv.style.color = "#ff4d4d"; errorDiv.style.fontSize = "13px"; errorDiv.style.marginTop = "5px"; errorDiv.style.fontWeight = "500"; inputElement.parentNode.appendChild(errorDiv); } // Helper function to clear previous error messages on retry function removeExistingError(formElement) { const existingError = formElement.querySelector(".metform-custom-error"); if (existingError) { existingError.remove(); } const emailInput = formElement.querySelector('input[type="email"]'); if (emailInput) { emailInput.style.borderColor = ""; } } });