ui:emptyValue is ignored for select widgets, requiring messy workarounds to resolve due to the way that the empty value option is injected.
The workaround that works is to specify a non-falsy empty value (e.g. "0") as the default for the form input (required in order to prevent the empty <option> from being injected), add your own empty value to the enum / enumNames (e.g. "0" as the value, "None" as the name), then reprocess to treat that empty value appropriately in the code dealing with the form (if "0" is OK then that's fine, but if you want a falsy default, e.g. an empty string, more work is required).
Obviously this is much more complex than just specifying ui:emptyValue with the desired value.
ui:emptyValue settingui:emptyValue is not usedSimple playground reproduction
The formData value should be the ui:emptyValue when the empty option is selected.
There is no formData value for the field when the empty option is selected.
Current playground version.
Same problem here...
This problem triggers the warning:
"Warning: value prop on select should not be null. Consider using an empty string to clear the component or undefined for uncontrolled components."
"@material-ui/core": "3.2.2"
I have similar issue with the enums. Here is the playground link
Based on the documentation here - https://react-jsonschema-form.readthedocs.io/en/latest/validation/#the-case-of-empty-strings
when enum is used with select widget, an empty option is added in the dropdown. This is not happening in the playground link I shared above.
And yes, ui:emptyValue does not work for me.
Also, ui:placeholder not working for me. I don't see "choose" in the Status dropdown.
Am I missing anything?
As far as I can see, the processValue() method of SelectWidget returns undefined if a field is an empty string.
Is that it?