I've got a SelectInput
with two choices:
<SelectInput source="existing_user" choices={[
{ id: 'existing', name: 'Existing'},
{ id: 'new', name: 'New User' },
]} validate={required} />
I also have a DependInput
component that renders other fields, depending on the value of existing_user
. I would like the first option ('existing') to be selected by default. However the SelectInput
field is always empty when the form loads, so no other fields are visible:
I tried setting the underlying SelectField
's value
property to 'existing' through options
, but then I'm unable to edit the SelectInput
(clicking the second option does nothing).
I'm probably missing something simple since this should be elementary, but I couldn't find anything helpful in the documentation about it.
Using defaultValue
either on the SelectInput
or on the form containing it should do the trick: