rival-black
rival-black3w ago

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
kapa.ai
kapa.ai3w ago
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:
npm create refine-app@latest -- --example field-antd-use-select-basic
npm create refine-app@latest -- --example field-antd-use-select-basic
For an infinite loading example:
npm create refine-app@latest -- --example field-antd-use-select-infinite
npm create refine-app@latest -- --example field-antd-use-select-infinite
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: ----------------------
kapa.ai
kapa.ai3w ago
<@224018850419572736> kapa.ai is still learning and improving, please let us know how it did by reacting below