Registration Form Password Validation


Topic: Registration Form Password Validation

Byron Cross asked 6 years ago

I used the registration and login modal on the site and I'vemagaed to get everything else validated but the password and retype password validation isn't going so well. I have attached the code of what I thought was correct. If anyone can please let me know where I'm going wrong that would be amazing. Thank you.

if(registerPassword == registerRetypePassword){
      document.getElementById('registerStatus').innerHTML = "Passwords Match";
      return true;
    }else{
      document.getElementById('registerStatus').innerHTML = "Passwords do not match";
      return false;
    }

I have declared the variables above this script. Thank you.


Magdalena Dembna staff premium commented 6 years ago

Basic logic seems to be ok. Can you please provide entire code snippet here: https://mdbootstrap.com/snippets/ ? It would be much easier to find a problem.


Byron Cross commented 6 years ago

Here is the snippet: https://mdbootstrap.com/snippets/jquery/byron_cross/792250 thank you.


Magdalena Dembna staff premium answered 6 years ago

If you could open the following link and look at the material styles example: https://mdbootstrap.com/docs/jquery/forms/validation/#custom-styles

Firstly, invalid feedback message is a div element below the input with invalid-feedback class. In JavaScript tab you can look at a validation - unsuccessful passwords matching should call event.preventDefault() for submit - if not, form will be still send and modal closed.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.0
  • Device: Mac
  • Browser: Chrome
  • OS: Ojave
  • Provided sample code: No
  • Provided link: No