Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registration form client side validation #40

Open
Brymon opened this issue Aug 17, 2018 · 0 comments
Open

registration form client side validation #40

Brymon opened this issue Aug 17, 2018 · 0 comments

Comments

@Brymon
Copy link

Brymon commented Aug 17, 2018

    // checks that anything has been entered into password fields
    if (password.validity.valueMissing || confirmPassword.validity.valueMissing) {
      error.innerHTML = "Please enter a password and confirm your password";
      error.className = "error";
      password.classList.add("incorrect-field");
      confirmPassword.classList.add("incorrect-field");
      return;
    }

  // checks that email is valid
  if (regEmail.validity.typeMismatch || regEmail.validity.valueMissing) {
    console.log("reached");
    error.innerHTML = "Please enter a valid email address";
    error.className = "error";
    regEmail.classList.add("incorrect-field");
    return;
  }

  // checks that anything has been entered into password fields
  if (password.validity.valueMissing || confirmPassword.validity.valueMissing) {
    error.innerHTML = "Please enter a password and confirm your password";
    error.className = "error";
    password.classList.add("incorrect-field");
    confirmPassword.classList.add("incorrect-field");
    return;
  }

looks like you repeat the same if statement twice @ checks that anything has been entered into password fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants