Skip to content

feat(pages): add useForm setError and clear field errors on change - #590

Merged
cpojer merged 2 commits into
voidzero-dev:mainfrom
0froq:cursor/feat-useform-seterror-dbee
Oct 26, 2026
Merged

cpojer merged 2 commits into
voidzero-dev:mainfrom
0froq:cursor/feat-useform-seterror-dbee

Conversation

@0froq

@0froq 0froq commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Fixes #525

Summary

Adds setError(field, message) to useForm across React, Vue, Svelte, and Solid so apps can surface client-side validation through the same typed errors object as server withValidator() responses. Changing a field clears that field's validation error automatically (setData / data assignment).

Changes

  • Add public setError(field, message) on useForm for all four frameworks.
  • Clear errors[field] on field change via setData (React/Solid) or data assignment (Vue/Svelte).
  • Update docs for actions/forms and the pages API reference.
  • Add Vue unit coverage for setError and clear-on-change.

Testing

  • packages/vue/test/unit/use-form.test.ts
  • Typecheck @void/react, @void/vue, @void/svelte, @void/solid

Fixes voidzero-dev#525

## Summary

Adds `setError(field, message)` to `useForm` across React, Vue, Svelte, and Solid so apps can surface client-side validation through the same typed `errors` object as server `withValidator()` responses. Changing a field clears that field's validation error automatically (`setData` / `data` assignment).

## Changes

- Add public `setError(field, message)` on `useForm` for all four frameworks.
- Clear `errors[field]` on field change via `setData` (React/Solid) or `data` assignment (Vue/Svelte).
- Update docs for actions/forms and the pages API reference.
- Add Vue unit coverage for `setError` and clear-on-change.

## Testing

- `packages/vue/test/unit/use-form.test.ts`
- Typecheck `@void/react`, `@void/vue`, `@void/svelte`, `@void/solid`

Co-authored-by: froQ <sayhola@froq.me>
@cpojer
cpojer self-requested a review October 26, 2026 07:05
@cpojer
cpojer force-pushed the cursor/feat-useform-seterror-dbee branch from ed7548d to e019196 Compare October 26, 2026 07:15

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bunch of things, merging.

@cpojer
cpojer merged commit f6cc481 into voidzero-dev:main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useForm: support client-side validation (or at least setError)

3 participants