|
12 | 12 | from reflex.components.tags.tag import Tag |
13 | 13 | from reflex.constants import Dirs, EventTriggers |
14 | 14 | from reflex.event import ( |
| 15 | + FORM_DATA, |
15 | 16 | EventChain, |
16 | 17 | EventHandler, |
17 | 18 | checked_input_event, |
18 | 19 | float_input_event, |
19 | 20 | input_event, |
20 | 21 | int_input_event, |
21 | 22 | key_event, |
| 23 | + on_submit_event, |
| 24 | + on_submit_string_event, |
22 | 25 | prevent_default, |
23 | 26 | ) |
24 | 27 | from reflex.utils.imports import ImportDict |
|
28 | 31 |
|
29 | 32 | from .base import BaseHTML |
30 | 33 |
|
31 | | -FORM_DATA = Var(_js_expr="form_data") |
32 | 34 | HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string( |
33 | 35 | """ |
34 | 36 | const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => { |
@@ -110,24 +112,6 @@ class Fieldset(Element): |
110 | 112 | name: Var[str] |
111 | 113 |
|
112 | 114 |
|
113 | | -def on_submit_event_spec() -> tuple[Var[dict[str, Any]]]: |
114 | | - """Event handler spec for the on_submit event. |
115 | | -
|
116 | | - Returns: |
117 | | - The event handler spec. |
118 | | - """ |
119 | | - return (FORM_DATA,) |
120 | | - |
121 | | - |
122 | | -def on_submit_string_event_spec() -> tuple[Var[dict[str, str]]]: |
123 | | - """Event handler spec for the on_submit event. |
124 | | -
|
125 | | - Returns: |
126 | | - The event handler spec. |
127 | | - """ |
128 | | - return (FORM_DATA,) |
129 | | - |
130 | | - |
131 | 115 | class Form(BaseHTML): |
132 | 116 | """Display the form element.""" |
133 | 117 |
|
@@ -167,7 +151,7 @@ class Form(BaseHTML): |
167 | 151 | handle_submit_unique_name: Var[str] |
168 | 152 |
|
169 | 153 | # Fired when the form is submitted |
170 | | - on_submit: EventHandler[on_submit_event_spec, on_submit_string_event_spec] |
| 154 | + on_submit: EventHandler[on_submit_event, on_submit_string_event] |
171 | 155 |
|
172 | 156 | @classmethod |
173 | 157 | def create(cls, *children, **props): |
|
0 commit comments