Skip to content

Cannot change question type and allows_additional_textanswers of text/heading questions simultaneously  #2539

@Kakadus

Description

@Kakadus
  1. Go to http://localhost:8000/staff/questionnaire/102/edit (questionnaire with text or heading question)
  2. change the type of Sonstige Kommentare zur Masterarbeit: to e.g. positive agreement
  3. allow additional textanswers of Sonstige Kommentare zur Masterarbeit: (checkbox ui is enabled after 2.)
  4. submit questionnaire edit form
  5. Visit http://localhost:8000/staff/questionnaire/102/edit again

See that additional textanswers of Sonstige Kommentare zur Masterarbeit: are NOT allowed.

When constructing the form, we always disable the textanswers field if self.instance.type in [QuestionType.TEXT, QuestionType.HEADING], i.e. not the type (potentially) submitted by the user. Thus, django always removes the allows_additional_textanswers value submitted by the user, even if the question type was also changed.

Note that we cannot enable the field in the clean* functions, as this is too late. I could not find other occurrences, as only non-user-editable fields are used elsewhere to dynamically disable form fields.

Found during reimplementation of the question form in #2513.
#2482 is somewhat related.

Metadata

Metadata

Labels

[C] BackendFocuses on backend implementation[C] FrontendFocuses on frontend implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions