Skip to content

feature request: required attribute and empty choice for dropdown #221

@horriblename

Description

@horriblename

I need a single-selection dropdown that makes sure an option is selected before submitting the form: https://git.uni-due.de/fmi/autotool-dev/-/merge_requests/70#note_250192

This is usually done like this in html:

<select required>
  <option value="">---</option>
  <option value="1">One</option>
  ...

The important parts being required attribute and an option with value="" (has to be the first element)

Right now required can be set easily with fsAttrs, but value is "hard-coded" to [1..] in

formifyImplementation = renderNextSingleChoiceField (`zip` [1..]) . (=<<) getAnswer

I'm thinking we can check for the required attribute in renderNextSingleChoiceField and, if it exists, add an additional option with value=""

(Of course there are probably other ways to implement this)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions