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

revalidateField fails with rules added via addRequiredGroup

shawnheide opened this issue · comments

Thanks for your time and work on this project, it's been helpful in migrating from jQuery. When using revalidateField, rules added with addRequiredGroup fail since they aren't in this.fields.

if (!key || !this.fields[key]) {

I thought about adding a validateGroup method, but clearFieldStyle and renderFieldError both rely on this.fields too, so those would need a "groups" version as well. Does anyone have thoughts on a clean way to do this? My preference would be to use revalidateField for both fields and groups.

Hey! Thanks! I think it's possible to add revalidateGroup method (btw validateGroup already exists).
We don't actually need to use clearFieldStyle as we don't have styles for groups.
Also we already have renderGroupLabel method.

So it should be easy to implement a new method, I will look into that today-tomorrow.

Added the revalidateGroup method. Hope it helps.

Wow, thanks for the quick reply and implementation, I really appreciate it.