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

[REF-1368] Move common form functionality to rx.el.forms #2801

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Mar 7, 2024

Allow plain HTML Form element to have magic on_submit event handler.

Chakra and Radix forms inherit on_submit functionality from rx.el.form

Consolidate logic in the basic HTML form and use it in both Radix and Chakra form wrappers.

Update test_form_submit.py

Run the integration test with all three types of form roots to ensure consistent behavior.

masenf added 2 commits March 6, 2024 16:03
Allow plain HTML Form element to have magic on_submit event handler.
Consolidate logic in the basic HTML form and use it in both Radix and Chakra
form wrappers.
Copy link

linear bot commented Mar 7, 2024

Copy link
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

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

I think the auto-docs don't show the extra props, but I'm leaning in favor of removing some of the base html props to keep our api simple (can do later on)

@overload
@classmethod
def create( # type: ignore
cls,
*children,
as_: Optional[Union[Var[str], str]] = None,
accept: Optional[
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep all these other props also, do they work? We could delete them in the base el.Form, I think it may add more noise/clutter than benefit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The radix form for sure supports all of the native HTML Form props... chakra, i'm less sure about. At any rate, i don't think these will show up in the API docs, but I'll check before merging

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The base form props are not rendering in the API docs. going ahead with the merge.

@masenf masenf merged commit 5d647a4 into main Mar 7, 2024
45 checks passed
@masenf masenf deleted the masenf/plain-form-on-submit branch March 7, 2024 21:17
@cllatser
Copy link
Contributor

cllatser commented Mar 7, 2024

Hi, the on_submit works perfectly in the rx.el.form.
Thank you so much.
💯

mahrz24 pushed a commit to mahrz24/reflex that referenced this pull request Mar 12, 2024
…2801)

* [REF-1368] Move common form functionality to rx.el.forms

Allow plain HTML Form element to have magic on_submit event handler.

* Chakra and Radix forms inherit `on_submit` functionality from rx.el.form

Consolidate logic in the basic HTML form and use it in both Radix and Chakra
form wrappers.

* from __future__ import annotations for py38
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.

3 participants