Closed maxime-carbonneau closed 1 year ago
Hey, I agree with you. It would definitely be a smart addition. However, I'm not set on how we should implement this syntax wise.
IMO customValidator(value, field, form)
would make the most sense, where field and form would be optional. The problem with this approach would be that it is a breaking change.
I'll look into this when I'm back from my vacation but I'm also open for suggestions.
My suggestion would be, at first, to bind the current field to the customValidation.
customValidation.bind(field)(value, form);
In version 3, you could change the function signature to customValidation(value, field, form) and maybe keep the bind also.
Looks like this is the way to go. Are you interested in implementing this?
I chose to add the control
(field) as an additional parameter instead of binding it. Since it would otherwise not be compatible with arrow functions.
It is now available in version 2.9.0 https://github.com/noahsalvi/svelte-use-form/releases/tag/2.9.0
Hello,
It would be nice to have access to the current field in a custom validation.
or