You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using both value and on_change for a form field with a label and a text input, it results in the error message: TypeError: Only Radix TextFieldRoot is allowed as child of FormControl. But it seems this should be allowed.
To Reproduce
Steps to reproduce the behavior:
See details in the discussion below.
Expected behavior
A form field with a label and text input should be able to have a value set and an on_change event handler.
Screenshots
n/a
Specifics (please complete the following information):
Originally posted by pglevy July 7, 2024
Hi there,
I'm just starting to play around with Reflex and was going through the Chat App tutorial, but I'm having trouble with the form field behavior when trying to use a label.
Here's a reference on codepen of what I'm trying to achieve: a text input with a programmatically associated label (so the input receives focus when you click the label) that you can interact with by typing into it.
I started with this basic example, which seems to work, but when I start using state, I run into two problems:
When I try to use the value parameter on the input to reference the state variable, it loses the connection to the label. (Looks like the id doesn't get rendered on the input.) Also, I can't change the value of the input by typing into it.
When I try to use on_change to listen for changes and update the variable, compiling fails with the error: TypeError: Only Radix TextFieldRoot is allowed as child of FormControl.
It seems like I'm not grasping something about state and how it works, so I appreciate any help pointing me in the right direction.
Describe the bug
When using both
value
andon_change
for a form field with a label and a text input, it results in the error message:TypeError: Only Radix TextFieldRoot is allowed as child of FormControl
. But it seems this should be allowed.To Reproduce
Steps to reproduce the behavior:
See details in the discussion below.
Expected behavior
A form field with a label and text input should be able to have a value set and an on_change event handler.
Screenshots
n/a
Specifics (please complete the following information):
Additional context
Discussed in https://github.com/orgs/reflex-dev/discussions/3629
Originally posted by pglevy July 7, 2024
Hi there,
I'm just starting to play around with Reflex and was going through the Chat App tutorial, but I'm having trouble with the form field behavior when trying to use a label.
Here's a reference on codepen of what I'm trying to achieve: a text input with a programmatically associated label (so the input receives focus when you click the label) that you can interact with by typing into it.
I started with this basic example, which seems to work, but when I start using state, I run into two problems:
value
parameter on the input to reference the state variable, it loses the connection to the label. (Looks like the id doesn't get rendered on the input.) Also, I can't change the value of the input by typing into it.on_change
to listen for changes and update the variable, compiling fails with the error:TypeError: Only Radix TextFieldRoot is allowed as child of FormControl
.It seems like I'm not grasping something about state and how it works, so I appreciate any help pointing me in the right direction.
I have this here on a repl and the code pasted below.
The text was updated successfully, but these errors were encountered: