Skip to content

Require answer for multiselect #1694

Answered by sisp
roaldarbol asked this question in Q&A
Discussion options

You must be logged in to vote

You can define a validator:

toppings:
  type: str
  help: Select pizza toppings
  multiselect: true
  choices:
    - tomato
    - cheese
    - salami
  default: [tomato]
  validator: >
    {%- if toppings | length < 1 -%}
    You must select at least one topping
    {%- endif -%}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@roaldarbol
Comment options

Answer selected by roaldarbol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants