Skip to content

Commit

Permalink
🐛 [#4980] Add empty string to list of choices to account for an unfil…
Browse files Browse the repository at this point in the history
…led field

If a field is not required, but sent anyway, it's value is an empty string
  • Loading branch information
viktorvanwijk committed Jan 14, 2025
1 parent 466e7fd commit ca6bb5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/openforms/formio/components/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ def as_json_schema(component: SelectComponent) -> JSONObject:
label = component.get("label", "Select")

choices = [options["value"] for options in component["data"]["values"]]
choices.append("") # Take into account an unfilled field

base = {"type": "string", "enum": choices}
if multiple:
Expand Down Expand Up @@ -838,6 +839,8 @@ def as_json_schema(component: RadioComponent) -> JSONObject:
label = component.get("label", "Radio")

choices = [options["value"] for options in component["values"]]
choices.append("") # Take into account an unfilled field

base = {"title": label, "type": "string", "enum": choices}

return base
Expand Down

0 comments on commit ca6bb5e

Please sign in to comment.