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
Yes. You can definitely do that. But this issue is not about antd-form-builder, it's about Antd Form. You have to listen the changes in 'favoriteFruit' field and then conditionally remove the other field. I leave an example below.
constFruitForm=()=>{const[form]=Form.useForm();// Only usable when [email protected] or aboveconstfavoriteFruit=Form.useWatch('favoriteFruit',form);constmeta=[{key: 'favoriteFruit',label: 'Favorite Fruit',widget: 'radio-group',options: ['Apple','Orange','Other'],initialValue: 'Apple',},favoriteFruit!=='orange'&&{key: 'disableInput',label: 'Sample Input to disable if the user selects Orange',widget: 'input',},].filter(Boolean);return'Some JSX';};
is there a way to define the condition to enable/disable fields inside the meta, For example
const meta = [
{
key: 'favoriteFruit',
label: 'Favorite Fruit',
widget: 'radio-group',
options: ['Apple', 'Orange', 'Other'],
initialValue: 'Apple',
},
{
key: 'disableInput',
label: 'Sample Input to disable if the user selects Orange,
widget: 'input',
},
]
I want to disable the input field if the user selects the Orange from the radio group
The text was updated successfully, but these errors were encountered: