Pristine icon indicating copy to clipboard operation
Pristine copied to clipboard

Equals does not work with the current version.

Open Pixney-William opened this issue 3 years ago • 5 comments

Works with the version included in the codepen. Tried that version locally and works fine. But with the version installed through npm "pristinejs": "^0.1.9" doesn't work.

Pixney-William avatar Sep 23 '20 15:09 Pixney-William

Hi @Pixney-William,

Looks like the js file in codepen is pointed to the same file which is in the master branch. Could you please check the diff between the 2 files you have?

sha256 avatar Sep 25 '20 10:09 sha256

Hi @Pixney-William,

Looks like the js file in codepen is pointed to the same file which is in the master branch. Could you please check the diff between the 2 files you have?

So, I downloaded the one from release and does not have equals. In my case, I usign the pristine.min.js from dist so I have no issues.

@sha256 could you please update both versions (release and npm)?

tsuginodan avatar Oct 20 '20 23:10 tsuginodan

I still see that the "equals" validation rule has not been included in an official release. Is there any chance of that happening soon? I have also installed Pristine 0.1.9 via npm and that rule is not included and that appears to be the latest release.

benjaminkohl avatar Aug 10 '21 14:08 benjaminkohl

Maybe it's obvious and not necessary, but here is small copy-paste piece, re-creating equals validator while problem is resolved.

Pristine.addValidator(
    'equals',
    function (val, otherFieldSelector) {
        var other = document.querySelector(otherFieldSelector);
        return other && ((!val && !other.value) || other.value === val);
    },
    'Fields do not match',
    1,
    true
);

hamsterwork avatar Oct 07 '21 11:10 hamsterwork

Here's a "fix" "pristinejs": "git+https://github.com/sha256/Pristine.git" Use this in your package.json and rerun npm install

kevinmu17 avatar Oct 14 '21 07:10 kevinmu17