6
6
7
7
@app ('/demo' )
8
8
async def serve (q : Q ):
9
- if q .args .show_inputs :
9
+ if q .args .show_inputs or q . args . textbox_submit :
10
10
q .page ['example' ].items = [
11
11
ui .text (f'textbox={ q .args .textbox } ' ),
12
12
ui .text (f'textbox_disabled={ q .args .textbox_disabled } ' ),
@@ -20,11 +20,7 @@ async def serve(q: Q):
20
20
ui .text (f'textbox_placeholder={ q .args .textbox_placeholder } ' ),
21
21
ui .text (f'textbox_disabled_placeholder={ q .args .textbox_disabled_placeholder } ' ),
22
22
ui .text (f'textbox_multiline={ q .args .textbox_multiline } ' ),
23
- ui .button (name = 'show_form' , label = 'Back' , primary = True ),
24
- ]
25
- elif q .args .enter_key_handler :
26
- q .page ['example' ].items = [
27
- ui .text (f'textbox_enter_key_handler={ q .args .enter_key_handler } ' ),
23
+ ui .text (f'textbox_enter={ q .args .textbox_enter } ' ),
28
24
ui .button (name = 'show_form' , label = 'Back' , primary = True ),
29
25
]
30
26
else :
@@ -41,7 +37,7 @@ async def serve(q: Q):
41
37
ui .textbox (name = 'textbox_placeholder' , label = 'With placeholder' , placeholder = 'I need some input' ),
42
38
ui .textbox (name = 'textbox_disabled_placeholder' , label = 'Disabled with placeholder' , disabled = True ,
43
39
placeholder = 'I am disabled' ),
44
- ui .textbox (name = 'enter_key_handler ' , label = 'Submits the textbox value on Enter key ' , icon = 'Search' ),
40
+ ui .textbox (name = 'textbox_submit ' , label = 'Submits on enter pressed ' , icon = 'Search' , submit = True ),
45
41
ui .textbox (name = 'textbox_multiline' , label = 'Multiline textarea' , multiline = True ),
46
42
ui .button (name = 'show_inputs' , label = 'Submit' , primary = True ),
47
43
])
0 commit comments