Skip to content

v4.1.0

Choose a tag to compare

@github-actions github-actions released this 26 Jul 15:12
· 4 commits to main since this release

⚠️ Behavior change — checkbox values

values[name].value for checkbox fields now reports the checked state as 'true' / 'false' instead of 'on'. The same applies to the value passed to a custom validations[name].validation({ value }) function.

Previously, per-field mode stored the checkbox's value attribute, which is 'on' whether checked or not — so the old value carried no information. Resolver mode was already correct; the two modes now agree.

If any code compares a checkbox value against 'on', update it to 'true'. Validation behavior is unchanged — required checkboxes were always validated against their checked state.

✨ New — reading optional fields

refValidation accepts trackUnvalidatedFields to put every named field in values, not just the ones being validated:

<form ref={(ref) => refValidation(ref, { trackUnvalidatedFields: true })}>
  <input name="email" type="email" required />
  <input name="company" type="text" />
</form>

values.company now updates as the user types, while numberOfRequiredFields stays 1 — tracking and requiredness are independent. This replaces the workaround of declaring a placeholder validations entry just to get an optional field registered.

Defaults to false, so existing per-field behavior is unchanged. No effect in resolver mode, which already tracks every named field.


What's Changed

🚀 Enhancement

  • ✨ feat: add trackUnvalidatedFields config option by @Randagio13 in #79

🐛 Bug Fix

  • 🐛 fix: report checkbox checked state in per-field mode values by @Randagio13 in #81

Full Changelog: v4.0.4...v4.1.0