Hello,
I’m trying to handle the visibility of an Atlaskit Form
field based on the value of another (see code below).
I tried handling state myself by using an onChange
on the RadioGroup
to retrieve its value but this just broke the Form
's data collection.
Strangely, I can’t find any examples of this kind of behaviour online.
Any ideas?
Thanks!
<Form onSubmit={onSubmit}>
{({ formProps }) => (
<form {...formProps}>
<Field name={'type'}>
{({ fieldProps }) => (
<RadioGroup
defaultValue={'show'}
options={[
{ name: 'type', value: 'show', label: 'Show select' },
{ name: 'type', value: 'hide', label: 'Hide select' },
]}
{...fieldProps}
/>
)}
</Field>
<Field
name={'application'}
label={'Select something'}
>
{({ fieldProps }) => (
<Select
className="single-select"
classNamePrefix="react-select"
options={things.map(a => ({ value: a.id, label: a.name }))}
placeholder="Choose a Something"
{...fieldProps}
/>
)}
</Field>
</form>
)}
</Form>