typesystem icon indicating copy to clipboard operation
typesystem copied to clipboard

Add `MultipleChoice` field.

Open lovelydinosaur opened this issue 6 years ago • 2 comments

Display as a <select multiple>

lovelydinosaur avatar Mar 04 '19 09:03 lovelydinosaur

Seems like this could either subclass Choice or inherit from Field directly. Do you have a preference? Also, I'm thinking it should include "min selected" and "max selected" as options. Anything else?

I'm happy to work on other fields/issues first if they're higher priority.

jhtimmins avatar Mar 07 '19 02:03 jhtimmins

I'd suggest:

  • Subclass Field.
  • Don't include min selected / max selected, at least for the initial pass. That can come later.

We'll want to think carefully about null and empty behaviors, eg:

  • We won't want to render an initial blank <choice> in the multiple case.
  • Forms with no values selected won't submit any value at all. For consistency we probably want MultipleChoice(default=[]) to be the typical usage - similar to BooleanField(default=False) being the correct way to have a checkbox that acts as False if it does not submit a value.

lovelydinosaur avatar Mar 07 '19 09:03 lovelydinosaur