Skip to content

Commit

Permalink
fix: array radio fields not switching value correctly closes #3141
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Jan 26, 2021
1 parent 29e5cff commit 3d4efef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ export function useForm<TValues extends Record<string, any> = Record<string, any
}

setInPath(formValues, field as string, newValue);
// multiple radio fields
if (fieldInstance && Array.isArray(fieldInstance)) {
fieldInstance.forEach(fieldItem => {
valuesByFid[fieldItem.fid] = newValue;
});
return;
}

if (fieldInstance) {
valuesByFid[fieldInstance.fid] = newValue;
}
Expand Down

0 comments on commit 3d4efef

Please sign in to comment.