networknt/react-schema-form

fix the logic for default value for Select component

Closed this issue · 0 comments

The default value defined in the schema can not be displayed in the enum string filed on the form.

After the fix, the logic for the default value calculation in the constructor.

  1. default value should be started with [] or "" depends on if it is multiple or singular.
  2. if form.default is defined, then use it, otherwise, use the form.schema.default instead.
  3. check if the model has a value and overwrite the default value for the currentValue.