Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onChange for FormField isn't triggered #7

Open
OriR opened this issue Mar 31, 2023 · 0 comments
Open

onChange for FormField isn't triggered #7

OriR opened this issue Mar 31, 2023 · 0 comments
Assignees

Comments

@OriR
Copy link

OriR commented Mar 31, 2023

Describe the bug
When creating a FormField with an onChange handler, the handler isn't called, even though it's defined om the type.

To Reproduce
Steps to reproduce the behavior:

<Form form={{ sections: [ { type: "boolean", title: "a", name: "a", label: "a", onChange: () => { throw new Error("never thrown"); }} ]}} />

Expected behavior
I'd expect the onChange handler to be called.

Additional context
I'm looking to conditionally render fields in a form as requested in #6 but I feel like having a custom manager for a built-in field just to get the onChange handler to work, feels too detailed for such a common task.

Plus, the onChange attribute is already part of the FormField definition so when working with typescript it tells you that it's already part of the API.

Anyway, thanks for this tool, was super easy to create a pretty cool form 🙏

P.S.
if you could support ink@4 and react@18 that would also be amazing!

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

No branches or pull requests

2 participants