horprogs / Just-validate

Modern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!). Support a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization. Support writing custom rules and plugins.

Home Page:https://just-validate.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make please the option to validate fields onChange/onInput events + default onSubmit ofc

SergeyXXI opened this issue · comments

Hi!

I've noticed form validating only after Submit event. Cool, but oftenly site owners like more onInput/onChange behavior validation. Make please such option to choose on JustValidate instance initiation and in addField method custom configuration.

And btw, I've noticed your validator for custom validation works immediately(like immitating onInput event) before submiting form, i.e before form validation start. Why? If I need some side effect in validator I get it instantly too. Maybe consider to make it in one way simultaneously? If form validation starts after submitting, then validator should also start work after Submit event, don't you think so?

Thx for atteniton! Big much!

Hi, could you please provide some example when the custom validation triggers before submitting the form? As I can see this is not happening:
https://just-validate.dev/examples/#advanced
https://just-validate.dev/examples/#async

Also, I'll think about the option to allow validation before submitting the form. It could be useful, thanks

Added a flag validateBeforeSubmitting to trigger validation before clicking the submit button
https://just-validate.dev/examples/#validate-before-submitting