Repository navigation
v4.2.0
⚠️ Behavior change — numberOfRequiredFields
The count is now over distinct field names rather than elements, which changes two things:
- A required radio group counts once. Marking a radio group mandatory means putting
requiredon every member, so a three-radio group previously counted as3. If you drive a "N of M complete" indicator offnumberOfRequiredFields, its denominator will drop. - Required elements without a
nameare no longer counted. rapid-form never tracked or validated them, so they produced a denominator no consumer could satisfy.
Nothing else about the count changed — ordinary named fields with required behave exactly as before.
🐛 Fixed — radio groups reported the wrong value in resolver mode
With radios free / pro / max sharing a name, selecting pro reported 'max'. Values were collected by walking form.elements, so every group member wrote to the same key and the last one in DOM order won regardless of which was checked.
values[name] now holds the selected member's value, and '' when nothing is selected.
Per-field mode was already correct and is unchanged — its listener reads the element the user clicked. This only affected forms using a resolver (including the Zod and Yup adapters).
<form ref={(ref) => refValidation(ref, { resolver: zodResolver(schema) })}>
<input type="radio" name="plan" value="free" required />
<input type="radio" name="plan" value="pro" required />
<input type="radio" name="plan" value="max" required />
</form>
// selecting "pro" → values.plan.value === 'pro' (was 'max')Still outstanding
<select multiple> reports only the first selected option, in both modes. Fixing it requires widening Value['value'] to string | string[], which is breaking — tracked in #85 with a costed prototype.
What's Changed
🐛 Bug Fix
- 🐛 fix: resolve radio groups as one field for value and required-count by @Randagio13 in #86
Full Changelog: v4.1.0...v4.2.0