Skip to content

Commit 319552b

Browse files
committed
Client-side validation triggered for fields starting with the same name as the one currently validating.
1 parent 2e6f4c0 commit 319552b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Support for `instance` and `special` validators for Valibot, which now enables File validation for Valibot!
1818
- `taintedMessage` didn't always work when navigating with the History API.
1919
- `tainted` didn't untaint automatically when using arrays.
20+
- Client-side validation triggered for fields starting with the same name as the one currently validating.
2021

2122
## [2.9.0] - 2024-03-12
2223

src/lib/client/superForm.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,9 @@ export function superForm<
859859

860860
const isEventError =
861861
error.value &&
862-
paths.map((path) => path.join('.')).some((path) => path.startsWith(joinedPath));
862+
paths
863+
.map((path) => path.join('.'))
864+
.some((path) => path.length <= joinedPath.length && path.startsWith(joinedPath));
863865

864866
if (isEventError && options.validationMethod == 'oninput') return addError();
865867

0 commit comments

Comments
 (0)