Skip to content

docs: add form button note #1353

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

Merged
merged 9 commits into from
Apr 2, 2025

Conversation

gioboa
Copy link
Contributor

@gioboa gioboa commented Mar 28, 2025

Fixes #1344

With form <button type="reset" ... /> the native form.reset will be triggered.
To prevent this behavior we can use event preventDefault.

image

@Pascalmh
Copy link
Contributor

The commit should start with docs: (instead of feat(docs), that makes a difference on what release type it will trigger.

@gioboa gioboa changed the title feat(docs): add form button note docs: add form button note Mar 30, 2025
@gioboa
Copy link
Contributor Author

gioboa commented Mar 30, 2025

I see, let me fix it. Thanks

@gioboa gioboa requested a review from Pascalmh March 30, 2025 19:15
@Pascalmh
Copy link
Contributor

It seems to extensive now, there's also code that doesn't do anything in the examples (importing styles, adding form.Subscribe but not actually using it)

I think going back to your original approach (short and to the point) and adding the final html/jsx code (so this <button type="reset" onClick={(event) => { event.preventDefault(); form.reset(); }}> and this <button type="button" onClick={() => { form.reset(); }}>) for the button would be perfect.

@harry-whorlow
Copy link
Contributor

I'm in agreement with @Pascalmh, the buttons are wrapped in Subscribe, but it's not used for anything personally I would slim it down. I'm also not certain we need the information duplicated, what do you guys think?

Other than that thanks for the PR! 🤟

@gioboa gioboa requested a review from harry-whorlow March 31, 2025 08:24
@harry-whorlow harry-whorlow merged commit a1568ff into TanStack:main Apr 2, 2025
1 check passed
@harry-whorlow
Copy link
Contributor

LGTM 🚀 thanks for the PR!!

juanvilladev pushed a commit to juanvilladev/form that referenced this pull request Apr 3, 2025
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.

Issue with form.reset() and <select>
3 participants