moeen-basra / ree-validate

Simple React.js input validation plugin extended from vee-validate
MIT License
16 stars 4 forks source link

Rule confirmed not working #2

Closed Jimmea closed 5 years ago

Jimmea commented 6 years ago

password: 'required|min:6', passwordConfirm: 'required|min:6|confirmed:password'

moeen-basra commented 6 years ago

sorry for late response I'll be looking into this.

moeen-basra commented 6 years ago

Sorry for delay I'm upgrading the project and will publish it soon with complete docs. I'm afraid to tell confirm will not work for now as it is written for vue js, for the time being you can do a manual compare for password.

Jimmea commented 6 years ago

Yes, :)) Thank u reply . I have been worked it

2018-02-21 3:56 GMT+07:00 Moeen notifications@github.com:

Sorry for delay I'm upgrading the project and will publish it soon with complete docs. I'm afraid to tell confirm will not work for now as it is written for vue js, for the time being you can do a manual compare for password.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/moeen-basra/ree-validate/issues/2#issuecomment-367116288, or mute the thread https://github.com/notifications/unsubscribe-auth/ALBg85Jb42e4ARvqvKdJLh2-eeNnzr8Bks5tWzFugaJpZM4RMdC7 .

sirpeas commented 6 years ago

@Jimmea How did you fix it in your project? In my case v3.0.2 it's doesn't work

moeen-basra commented 6 years ago

You have to do this menually at the moment.

joriling commented 6 years ago

Still have this issue , Is there other way to fix ? Thank you

password: 'required', password_confirmation: 'required|confirmed:password',

moeen-basra commented 6 years ago

unfortunately, its not ready yet. you can manually create a function for password fields match.

Quadriphobs1 commented 5 years ago

Any guide on how you were able to do it @moeen-basra I am trying to use custom rule but I can't figure out how to map the two fields together. I am having

ReeValidate.extend('confirmation', (value, [otherValue]) => {
  return value === otherValue;
}, {
  hasTarget: true,
});

but my concern is that ref is the approach for vue js which would not work in the react js since react js uses ref for something else internally

moeen-basra commented 5 years ago

I'm also using custom rule for now but working on new release and hope it will resolve all the basic problems.

The actual delay is due to time

Quadriphobs1 commented 5 years ago

Ohhh.... would be so kind as to share a guide approach to how you were able to solve it... or an approach how think it can be solved... I have trying to understudy the whole codebase to see if I can be of help but I am very tied up to finishing the project am working on now and this is the only delay I am having

Quadriphobs1 commented 5 years ago

Or if you can tell how to use the after rule then I think I can be able to solve it that way... I have been trying to implement the after rule as well @moeen-basra

moeen-basra commented 5 years ago

that also am doing manually

Quadriphobs1 commented 5 years ago

Wow....

Quadriphobs1 commented 5 years ago

@moeen-basra Please is there any exposed function which can let me get the value of a field by the name I get from the parameter ref[0] it think that should be used internally

Quadriphobs1 commented 5 years ago

So after serious digging into the library and the whole architecture, I first would like to commemorate @moeen-basra for a good job well done on the package, I know it is not an easy job to maintain an open source project but its a good job done, I give it 👍 . I saw the new revamp branch you were working and its a really huge one, hopefully, someday when am free I can help out on it, hope it welcomed to contribute.

So I was able to solve this by doing some little hack on the. after initializing my setup I had to check my method that call validate and defer the method call on the input I want to do comparison check.

if (name === 'compare') {
  const result = this.validator.rules.confirmed(value, otherValue);
      if (!result) {
        this.validator.errors.add(name, 'Comparison not matched');
      }
} else {
  // normal validator for all input
}

but I am not sure that is going to work for validateAll method though... hopefully that can save someone a day

moeen-basra commented 5 years ago

yes ofcourse every single contibution to opensource is valueable. The current version of package was not much modified and so was not very friendly with react except the general rules. But I'm sure the next version will not only work with react out of the box but also with any javascript library.

valentinfily commented 5 years ago

Any update on the above ? Many thanks

lochawala commented 4 years ago

Any update on the above ? Thanks for great package.