Closed djhi closed 7 years ago
I don't like so much the implementation of the confirmed
rule as it enforce to use underscore for the field name that ends with _confirmation
.
We should instead reimplement it to work like shouldBeEqualTo(fieldName)
validation function:
https://github.com/foxhound87/mobx-react-form/blob/master/docs/CustomValidationFunctions.md#define-custom-functions
(but without the needs of the additional prop related: ['theFieldName']
).
In fact, now, I think that the confirmed
rule will need the related
prop too, this because I am creating a new instance for each field. Otherwise we must provide the 2 fields (data and rules) and handle the error message for those inputs in a different way.
Thank you for your involvement and help!
I agree as I don't like it much too but if you provide the option to use validatorjs, shouldn't we expect it to work as it has been designed to ?
Yes it should, but it's not high priority right now. Are you working on it anyway?
Hi,
The
confirmed
rule from validatorjs cannot work currently as the validateFieldSync method only passes the field to validate instead of the fields array.I'll try to submit a PR about this asap