Open tylergannon opened 4 months ago
For now I have found a workaround this. I basically create a emptySelection object const emptySelection={value: '', label:''}
and pass it as selected inside the Root of the select element.
With this my zod validation works but you need to also specify the min function to check for a value of >1. Then it will show your validation message as well.
Describe the bug
See the demo repo. The demo is in the root route. When user makes no selection in a Select control and then posts the form, the
Select.Input
hidden input will post the string value "undefined".I'd like to suggest that the appropriate thing would be to post empty string or else omit the hidden input from the form post.
If this is by design, it might be good to denote it as such in the docs so that authors using this control know what to test for in their form action backend code.
Reproduction
Expect: An empty string or no value to be submitted. Actual: The string value "undefined" will be submitted.
Logs
No response
System Info
Severity
annoyance