View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
20421Bug reportsSurvey editingpublic2026-02-11 09:04
ReporterSESSOU Assigned To 
PrioritynoneSeverityblock 
Status newResolutionopen 
Product Version6.12.x 
Summary20421: Question attributes should be sanitized when you change the question type ...
Description

When you change the type of an existing question (by selecting a new question family), the attributes that has been initialy chosen (for the first question type) can override the attributes chosen for the new question type. See example below …

Steps To Reproduce

1 - Create a new question with a 'table' type (type F)
2 - Add 3 subquestions like this : A, B and C
3 - Add 3 answer options like this : 1, 2 and 3
3 - Select random order in the display settings of the question
4 - Save the question

Content in the lime_question_attributes table at this moment :
qaid | qid | attribute | value | language
---------+--------+----------------------+-------+----------
1682391 | 639573 | min_answers | |
1682392 | 639573 | max_answers | |
1682393 | 639573 | array_filter | |
1682394 | 639573 | array_filter_style | 0 |
1682395 | 639573 | array_filter_exclude | |
1682396 | 639573 | exclude_all_others | |
1682397 | 639573 | random_group | |
1682398 | 639573 | em_validation_q | |
1682399 | 639573 | em_validation_q_tip | | fr
1682400 | 639573 | repeat_headings | |
1682401 | 639573 | answer_width | |
1682402 | 639573 | random_order | 1 |
1682403 | 639573 | hide_tip | 0 |
1682404 | 639573 | hidden | 0 |
1682405 | 639573 | cssclass | |
1682406 | 639573 | use_dropdown | 0 |
1682407 | 639573 | printable_help | | fr
1682408 | 639573 | page_break | 0 |
1682409 | 639573 | scale_export | 0 |
1682410 | 639573 | public_statistics | 0 |
1682411 | 639573 | statistics_showgraph | 1 |
1682412 | 639573 | statistics_graphtype | 0 |
1682413 | 639573 | image | |
1682414 | 639573 | save_as_default | N |

5 - Edit the question and change its type like this : multiple choice bootstrap button (type M)
6 - The 3 subquestions are still here
7 - Be sure that the normal order is selected in the display settings of the question
8 - Save the question
9 - Preview the question ... The display order of the subquestions is random and not normal !!!!

Content in the lime_question_attributes table after this change :
qaid | qid | attribute | value | language
---------+--------+-------------------------+--------+----------
1682418 | 639573 | other_replace_text | | fr
1682419 | 639573 | subquestion_order | normal |
1682420 | 639573 | display_columns | |
1682421 | 639573 | other_position | end |
1682422 | 639573 | other_position_code | |
1682423 | 639573 | button_size | |
1682391 | 639573 | min_answers | |
1682392 | 639573 | max_answers | |
1682393 | 639573 | array_filter | |
1682394 | 639573 | array_filter_style | 0 |
1682395 | 639573 | array_filter_exclude | |
1682396 | 639573 | exclude_all_others | |
1682397 | 639573 | random_group | |
1682398 | 639573 | em_validation_q | |
1682399 | 639573 | em_validation_q_tip | | fr
1682400 | 639573 | repeat_headings | |
1682401 | 639573 | answer_width | |
1682402 | 639573 | random_order | 1 |
1682403 | 639573 | hide_tip | 0 |
1682404 | 639573 | hidden | 0 |
1682405 | 639573 | cssclass | |
1682406 | 639573 | use_dropdown | 0 |
1682407 | 639573 | printable_help | | fr
1682408 | 639573 | page_break | 0 |
1682409 | 639573 | scale_export | 0 |
1682410 | 639573 | public_statistics | 0 |
1682411 | 639573 | statistics_showgraph | 1 |
1682412 | 639573 | statistics_graphtype | 0 |
1682413 | 639573 | image | |
1682414 | 639573 | save_as_default | N |
1682415 | 639573 | other_numbers_only | 0 |
1682416 | 639573 | assessment_value | 1 |
1682417 | 639573 | exclude_all_others_auto | 0 |
1682424 | 639573 | max_buttons_row | |

The 'random order' (which is a 'table' type display parameter) is still in the database and is used in place of the 'subquestion_order' parameter (which is a 'multiple answer' type display parameter).

So, when you change the type of a question, it would be nice to keep the attributes related to the new question type and to delete in the database (table 'lime_question_attributes') the attributes only related to the old question type

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build) 6.16.5+260127
I will donate to the project if issue is resolvedNo
BrowserAll kind (Safari, Google Chrome, Firefox)
Database type & versionPostgresql 15
Server OS (if known)Debian 12
Webserver software & version (if known)Apache 2.4
PHP Version8.2

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2026-02-10 10:21

developer   ~84200

My opinion

5 - Edit the question and change its type like this : multiple choice bootstrap button (type M)
6 - The 3 subquestions are still here
7 - Be sure that the normal order is selected in the display settings of the question

The point 7 must be "Be sure that the random order is set" : If question types have the same attribute, they must be the same as the previous question.
It was the behavior in 3.X

SESSOU

SESSOU

2026-02-11 09:04

reporter   ~84201

Hi,

I agree with you.

The problem here is that the attribute 'random order' remains in the table 'lime_question_attributes' after we change the type of the question (from 'table' to 'multiple choice'). So, it interfers with the attribute 'subquestion_order', which has the same fuction but is not taken into account, even if you try to change the value of the parameter thru the question editing web interface.,

So, it will be ideal when you change the type of a question to :

  • keep the common attributes of the old and the new question type, without modifying the values of these attributes
  • remove the attributes specific to the old question type
  • add the attributes specific to the new question type, with default values

I hope that these explanations will help you.

Cordially.

Olivier L.

Issue History

Date Modified Username Field Change
2026-02-09 18:46 SESSOU New Issue
2026-02-10 10:21 DenisChenu Note Added: 84200
2026-02-10 10:21 DenisChenu Bug heat 0 => 2
2026-02-11 09:04 SESSOU Note Added: 84201
2026-02-11 09:04 SESSOU Bug heat 2 => 4