@@ -126,6 +126,13 @@ class Person(BaseModel):
126126@app .post ("/form" )
127127async def form (form_data : list [dict ] = []):
128128 def form_generator (state : State ):
129+ class TestForm0 (FormPage ):
130+ model_config = ConfigDict (title = "Form Title Page 0" )
131+
132+ firstnumber : NumberExample = 3
133+
134+ form_data_0 = yield TestForm0
135+
129136 class TestForm1 (FormPage ):
130137 model_config = ConfigDict (title = "Form Title Page 1" )
131138
@@ -149,27 +156,10 @@ class TestForm1(FormPage):
149156
150157 form_data_1 = yield TestForm1
151158
152- # todo rename to avoid duplicate field names
153159 class TestForm2 (FormPage ):
154160 model_config = ConfigDict (title = "Form Title Page 2" )
155161
156- number : NumberExample = 3
157- text : Annotated [str , Field (min_length = 3 , max_length = 12 )] = "Default text"
158- textArea : LongText = "Text area default"
159- divider : Divider
160- label : Label = "Label"
161- hidden : Hidden = "Hidden"
162- # When there are > 3 choices a dropdown will be rendered
163- dropdown : DropdownChoices = "2"
164- # When there are <= 3 choices a radio group will be rendered
165- radio : RadioChoices = "3"
166- # checkbox: bool = True TODO: Fix validation errors on this
167-
168- # When there are <= 5 choices in a list a set of checkboxes are rendered
169- # multicheckbox: choice_list(MultiCheckBoxChoices, min_items=3) = ["1", "2"]
170- # list: choice_list(ListChoices) = [0, 1]
171-
172- person : Person
162+ anothernumber : NumberExample = 3
173163
174164 form_data_2 = yield TestForm2
175165
@@ -180,7 +170,7 @@ class TestSubmitForm(SubmitFormPage):
180170
181171 form_data_submit = yield TestSubmitForm
182172
183- return form_data_1 .model_dump () | form_data_2 .model_dump () | form_data_submit .model_dump ()
173+ return form_data_0 . model_dump () | form_data_1 .model_dump () | form_data_2 .model_dump () | form_data_submit .model_dump ()
184174
185175 post_form (form_generator , state = {}, user_inputs = form_data )
186176 return "OK!"
0 commit comments