sha256 / Pristine

Vanilla javascript form validation micro-library
https://pristine.js.org/
MIT License
410 stars 81 forks source link

Doesn't validate the data-pristine-equals. #82

Closed ArifuzzamanTusar closed 2 years ago

ArifuzzamanTusar commented 2 years ago
<input type="password" id="pwd" required data-pristine-required-message="Please Enter a password" 
data-pristine-pattern="/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$/" 
data-pristine-pattern-message="Minimum 8 characters, at least one uppercase letter, one lowercase letter and one number" class="form-control" />

<input type="password" data-pristine-equals="#pwd" data-pristine-equals-message="Passwords don't match" class="form-control" />

window.onload = function() {
        // pristinejs validation
        var form = document.getElementById("pristine-valid-example");
        var pristine = new Pristine(form);
        form.addEventListener('submit', function(e) {
            var valid = pristine.validate();
            // alert('Form is valid: ' + valid);
            if (valid) {
                return true;
            } else {
                e.preventDefault();
            }
        });
  }

Doesn't validate the data-pristine-equals