/* 1) fCheckForm - Check the form ============================== */ function fCheckForm() { if (document.fResetPassword.sEmail.value.trim()=="") { alert("Please enter in an email address"); return false; } if ( !IsValidEmail(document.fResetPassword.sEmail.value.trim()) ) { alert("Please enter in a valid email address"); return false; } // Return true return true; } /* 2) IsValidEmail - Checks if input is a valid email ================================================== */ function IsValidEmail(sText) { // Trim spaces sText = sText.trim(); // Regex for email let sEmailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; // Return if phone number or not return sEmailRegex.test(sText); }