React-jsonschema-form: Enum with select widget does not add a blank option at the top

Created on 23 May 2019  路  3Comments  路  Source: rjsf-team/react-jsonschema-form

Prerequisites

I facing an 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.

Notice that the Status dropdown does not have an empty option in it.
I tried adding ui:emptyValue and ui:placeholder to the UI scheme but even this did not work for me.
Am I missing anything?

Version

Latest version in playground

bug

Most helpful comment

If you remove the "default": "" from the playground links schema, it adds the empty option/placeholder.

I'm not sure if this is the expected behaviour for the default property.

All 3 comments

Related to #1041.

It looks like both ui:emptyValue and ui:placeholder are not working for your example, because the type is a boolean. So this may be a different (but related) bug to #1041.

Boolean is just an example, It happens with string values as well.

If you remove the "default": "" from the playground links schema, it adds the empty option/placeholder.

I'm not sure if this is the expected behaviour for the default property.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jabaren picture jabaren  路  3Comments

anttivikman picture anttivikman  路  3Comments

j-zimnowoda picture j-zimnowoda  路  3Comments

elyobo picture elyobo  路  3Comments

mfulton26 picture mfulton26  路  3Comments