View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
17330Bug reportsQuestion editorpublic2021-07-14 21:56
Reportermarcgold Assigned Togabrieljenik  
Status resolvedResolutionfixed 
Product Version3.25.20 
Summary17330: Ranking Question Issue
DescriptionWhen setting max number of answers on a Ranking questions and setting the question to mandatory you cannot proceed.

Error, You have to rank all options.
Steps To ReproduceCreate a Mandatory Ranking Question
Set Max number of answers to 3 (or anything you want)
Add more than the Max number of options.

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)Version 3.27.0+210525
I will donate to the project if issue is resolvedNo
Database & DB-Versionn/a
Server OS (if known)Centos 8
Webserver software & version (if known)
PHP Version7.3

Users monitoring this issue

User List There are no users monitoring this issue.




2021-05-31 15:46

manager   ~64678

How should the Ranking question behave?
What does it mean a ranking question to be mandatory?
Does it mean that all of the options need to be ranked?

Then that number of options to be ranked can be updated using max?

Am I right?


2021-06-01 10:11

reporter   ~64683

Last edited: 2021-06-08 23:07

Hi Gabriel

Thanks for picking this up. IMHO a mandatory question is one that "Must" receive a response in order to proceed. However I believe that any conditions / sub options that are also set need to be respected.

For the purposes of the example it is assumed there are 4+ SubQuestions in the Ranking Question:

So for instance, in the ranking question that is mandatory and has the MIN (blank) AND MAX 3 answers then the behaviour should be:
* 0 Ranked: Mandatory Condition Not Met - Do Not Continue.
* 1 - 3 Ranked: Mandatory Condition Satisfied, MIN 0 & MAX 3 Condition met - OK to Continue

However in the event that MIN == 3 & MAX == 3 then user must rank 3 SQ's to continue.

To me this is logical. However currently if you set a MAX value less than the total number of SQ's and Mandatory is on then it is not possible to complete the ranking question. Hence you have to turn Mandatory off which means you risk a question being skipped.

I hope that all makes sense, but reply if anything is not clear.

Thanks Marc


2021-06-01 14:53

manager   ~64688

Last edited: 2021-06-08 23:07

Yes, I think the issue here is that mandatory is making all SQ to be ranked, while it should be, at least 1.
Doing it just like that seems a strong thing to change, as per backward compatibility.

So, I would do,
If mandatory is set and no min nor max, I wouldn't update the behaviour (prior compatibility)
If mandatory is set and min or max, mandatory would mean at least 1 option ranked.
@c_schmitz, what do you think about this?


2021-06-01 20:02

reporter   ~64697

Last edited: 2021-06-08 23:07

That would work assuming it didn't interfere with the options.
but as a purest it would make send to code around the conditions


2021-06-01 20:35

reporter   ~64699

Last edited: 2021-06-08 23:07

Let me rephrase that last comment.

That would work assuming it didn't interfere with the options.
but as a purest it would make sense to code around the options (MIN / MAX) conditions

But I suppose, if Mandatory was set and that condition was satisfied by selecting one choice, if the option Min 3 was set then it would trigger the error condition around the option.


2021-06-07 20:49

manager   ~64774

Last edited: 2021-06-08 23:07

@c_schmitz, what do you think about this?


2021-06-09 11:54

administrator   ~64792

I agree to the concept of making a smaller change, to not break BC.


2021-06-09 11:55

administrator   ~64793

Maybe Fredrik has an opinion too? Will ping him.


2021-06-14 17:03

manager   ~64896

@f_funke ?


2021-06-14 17:03

administrator   ~64897

Fredrik is on vacation this week.


2021-06-23 13:28

developer   ~65008

I could reproduce the issue with 5.0.4. The behavior illustrates a general flaw of LimeSurvey, which also affects other question types like multiple choice.

Currently, logical rules implicitly make a question mandatory. So if minimum or maximum answers are set in the logic section a question has to be answered to proceed in the questionnaire. But sometimes a survey researcher just wants to communicate how answers should be ideally answered while allowing the respondent not to comply with these instructions (in paper and pencil questionnaires respondents can neglect instructions, too).

I'd prefer to disentangle the option for making a question mandatory and the question logic and suggest the following general behavior:
- the mandatory option (on | soft | off) is used to determine if a response is required
- the logic (e.g., min/max answers) is used to specify how a question should be answered

The independent combination of mandatory and logic gives researchers most flexibility:
case 1: mandatory == no and logic == no: no answer has to be given, question can be skipped
case 2: mandatory == yes AND logic == no: question has to be fully answered (here: all SQs have to be ranked) to proceed
case 3: mandatory == yes AND logic == yes: the rules described in logic (here: min/max) have to be met to proceed
case 4: mandatory == no AND logic == yes: information on max/min responses/numbers is displayed in the questionnaire but respondent can give any or no answer and proceed

Currently, only cases 1 and 2 are implemented in LimeSurvey. Case 3 and case 4 most probably mean a bigger change without backward compatibility. But in my eyes, this would make LimeSurvey more versatile.


2021-06-23 13:28

developer   ~65009

Additional remark on min and max answers:
case 1: If only minimum answers are set, the instruction is "Please select at least n answer(s)".
case 2: If only maximum answers are set, the instruction is "Please select at most n answer(s)".
case 3: If minimum and maximum answers are set, the instruction is "Please select from n to m answers".
case 4: If minimum answers equals the maximum answers, the instruction is "Please select n answers".

I think that it would be better to update the wording for case 4: "Please select exactly n answers"


2021-06-23 16:21

manager   ~65019

So @f_funke, we can apply the change suggested here?

I would apply it and then review how the system reacts and compare it to your notes.
What do you think?


2021-06-24 11:43

developer   ~65039

Last edited: 2021-06-24 11:44

View 2 revisions

Sounds good to me. Also to @c_schmitz?


2021-07-01 17:45

manager   ~65191


Finally, we made changes for this behaviour:

Mandatory Validation
- If min_answers or max_answers is set, there must be at least one response. Failing message is "Please rank the items.".
- If neither limit is set, all options must be ranked. Failing message is as usual: "Please rank all items."

It is not exactly how Fredrik wanted as mandatory validations and max/min validations are separate processes.
Still, I think it is OK.

Still, there is a case in which redundant messages appear.

- a min or max is set
- and you do not select any option.

In this case, two messages will appear:
- one saying that a question was not answered (mandatory validation)
- other saying that a question was not answered in a valid way (in / max validation).


2021-07-01 18:25

developer   ~65192

I still didn't understand : it's a conceptual logical issue …

I can report an issue on numeric question type where i put min to 10 and max to 5 ?


2021-07-13 16:38

manager   ~65429

Fix committed to 3.x-LTS branch:


2021-07-14 20:24

manager   ~65444

PR for Master:


2021-07-14 21:55

manager   ~65447

Fix committed to master branch:

Related Changesets

LimeSurvey: 3.x-LTS 50d949a4

2021-07-13 16:09:02


Committer: GitHub Details Diff
Fixed issue 17330: Ranking Question issue with mandatory setting (#1941) Affected Issues
mod - application/helpers/expressions/em_manager_helper.php Diff File

LimeSurvey: master 203ea3ed

2021-07-14 21:55:36


Committer: GitHub Details Diff
Fixed issue 17330: Ranking question mandatory validation is confusing (#1966) Affected Issues
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2021-05-27 18:35 marcgold New Issue
2021-05-28 15:36 gabrieljenik Assigned To => gabrieljenik
2021-05-28 15:36 gabrieljenik Status new => assigned
2021-05-28 15:38 gabrieljenik Assigned To gabrieljenik =>
2021-05-28 15:38 gabrieljenik Assigned To => gabrieljenik
2021-05-31 15:46 gabrieljenik Note Added: 64678
2021-06-01 10:11 marcgold Note Added: 64683
2021-06-01 14:53 gabrieljenik Note Added: 64688
2021-06-01 20:02 marcgold Note Added: 64697
2021-06-01 20:35 marcgold Note Added: 64699
2021-06-07 20:49 gabrieljenik Note Added: 64774
2021-06-09 11:54 ollehar Note Added: 64792
2021-06-09 11:55 ollehar Note Added: 64793
2021-06-14 17:03 gabrieljenik Note Added: 64896
2021-06-14 17:03 ollehar Note Added: 64897
2021-06-23 13:28 f_funke Note Added: 65008
2021-06-23 13:28 f_funke Note Added: 65009
2021-06-23 16:21 gabrieljenik Note Added: 65019
2021-06-24 11:43 f_funke Note Added: 65039
2021-06-24 11:44 f_funke Note Edited: 65039 View Revisions
2021-07-01 17:45 gabrieljenik Note Added: 65191
2021-07-01 18:25 DenisChenu Note Added: 65192
2021-07-05 18:14 gabrieljenik Status assigned => testing
2021-07-13 16:38 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 50d949a4
2021-07-13 16:38 gabrieljenik Note Added: 65429
2021-07-13 16:38 gabrieljenik Resolution open => fixed
2021-07-14 20:24 gabrieljenik Note Added: 65444
2021-07-14 21:55 gabrieljenik Changeset attached => LimeSurvey master 203ea3ed
2021-07-14 21:55 gabrieljenik Note Added: 65447
2021-07-14 21:56 c_schmitz Status testing => resolved