function check_agree(form) { var response = grecaptcha.getResponse(); //var regularExpression = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/; var passwordstring = form.password.value; var passwordconfirmstring = form.confirmpassword.value; if (passwordstring.length >= 6 && passwordconfirmstring == passwordstring && form.terms.checked) { return true; } else if (passwordstring.length < 6) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Password is too short' }) } else if (passwordstring.length < 6) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Password is too short' }) } else if (passwordconfirmstring != passwordstring) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Password Mismatched, please try again' }) } else if (!form.terms.checked) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'Please accept terms and conditions' }) } return false; }