31 Replies
but nice looking - using radix everywhere else but not sure where the select, option or input should go when converting to radix
this is it now but doesn't use the actual form inputs
I believe you can set
defaultValue
and name
on Select.Root
and it will work in as a form input.hmm doesn't seem to select it
defaultValue samee same
nvm
If you add
onValueChange((m) => console.log(m))
to root does it correctly log the values?yes, but the value isn't added to the form data
what form?
the lang field in the form doesn't change
with the select
you need to manually set the form field, I don't think radix does this automatically
i don't really see how it could
use the onChange callback
is it not a native select?
im using react-zorm
this worked
It's not a native select
It uses aria-attributes to give it the role of a dropdown but it's basically a div element, which lets you style it however you want
so you have to hook up the value of the select to the form
hmm fck i dont know if i can set the value manually in react-zorm, it kinda relies on the web api
yeah not sure, never used it
alright thanks anyways
worst case, add a hidden select and set that to the dropdown value
where would i put the select
or just a bunch of radios?
Put the select in the form somewhere but hide it
like a native select
with the options you need
and then use the radix select onChange to set the value of the hidden select box
something like this
radix does render a select though
Hm odd
It doesn't here unless I'm crazy
https://www.radix-ui.com/docs/primitives/components/select
hmm strange
all values in there too - they're just not linked
hm not sure then
very strange...
wait look
it's a nested form
or am I crazy
is the form it's inside your form or one generated by radix?
only one form in the DOM and it's mine
idk then
@julius Did you ever figure this one out?
@TobyMcCann If it helps, I had this same problem and solved it by passing a
name
prop to Select.Root
.