Make Select with nested name return null on no selection
I have an ant design <Select> component with a nested name that looks like this:
<Select name={['version', 'id']} ... />
When the associated for is submitted, if the select doesn't have a value, I want the corresponding value to be just null, but it's currently being passed as {id: undefined}. Is there a simple way to make all <Select> components with nested names to always return just null?
2 Replies
Hi @Hypnotic Meat. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, you might find the Ant Design Select API documentation (https://ant.design/components/select/#API) helpful for understanding how to customize the behavior of the
<Select>
component.
Additionally, you can explore the useSelect hook documentation (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-select/#example) for more examples and usage patterns that might help you achieve the desired behavior. If you need to run examples locally, you can use the following commands:
For a basic example:
For an infinite loading example:
These examples might provide insights or patterns that you can adapt to your specific use case.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@224018850419572736> kapa.ai is still learning and improving, please let us know how it did by reacting below