fabian-hiller / modular-forms

The modular and type-safe form library for SolidJS, Qwik and Preact
https://modularforms.dev
MIT License
995 stars 53 forks source link

Optional alternate behaviour for revalidateOn #225

Open Scott-MacD opened 2 months ago

Scott-MacD commented 2 months ago

Would it be possible to get an additional useForm config option to allow somebody to change the behaviour of revalidateOn to keep using that method after a field has been made dirty?

I prefer showing users an error message as soon as it is clear that they have likely made a mistake, to give the user the chance to make the corrections as they progress through a form. In order to do this, I have validateOn set to 'change', and revalidateOn set to input, which works great - however as soon as the user types a value that satisfies validation, if they continue to type and cause a case that fails validation, they won't know that until they blur from the field again. It would be ideal if we could set an option so that once a field has failed validation once, it will keep using the revalidateOn method from that point onwards.

fabian-hiller commented 2 months ago

Thanks for the idea. I will think about it, but unfortunately I will not have time to work on Modular Forms in the next few months.

Scott-MacD commented 2 months ago

Not a problem, I think I will take a shot at making that change for my project, happy to submit a PR if I get it figured out and you're aligned.

fabian-hiller commented 2 months ago

Yes, feel free to share your ideas. I plan to re rewrite the library as some point in the future.