Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Require multiple answers of a specific option in an array?

Require multiple answers of a specific option in an array? 2 years 5 months ago #74861

It's my first time trying to use JS in Limesurvey and it's giving me a bit of trouble.

We have an array question with a bunch of subquestions, and three question options. Basically, row after row of A, B or C. We want to default all answers to C, then require them to pick A for a minimum of two subquestions before it will let them continue.
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #74882

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

I think one of the easiest solutions might be to wait for the release of LimeSurvey 1.92 (which should be in a couple of days if I'm correct). In LimeSurvey 1.92 there are more possibillities for settings default values and you can use an expression to vaildate a question.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #74911

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
Steve, EM won't help much for the requirement of picking answer option A at least twice. This can only be done by coding some customized Javascript. EM can help though when setting default values, but if you have to use JS anyway, these are just 2 more lines of code to set the defaults.

@malberghini, please post a link to an activated sample survey which demonstrates the problem. This way we can have a look at the HTML source.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #74984

Here's the basic survey I have been working on:

www2.isye.gatech.edu/limesurvey/index.php?sid=92454&lang=en
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75278

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5302
  • Thank you received: 291
  • Karma: 247
Tony, this maybe you can create some JS magic?

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75282

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
malberghini wrote:
Here's the basic survey I have been working on:

www2.isye.gatech.edu/limesurvey/index.php?sid=92454&lang=en

How about re-designing the survey a little bit so that it doesn't require JavaScript?

If you make this a multiple choice question, you could set the min_answers advanced question option to 2 - that way they have to say "Yes" that they want to take at least two classes. Then, you can have an array_filter_exclude-ed question for the classes they did not want to take in which you can ask whether they can or can't take those classes.

You could even use the Ranking style question to let people specify their first and second choices, and still use array_filter_exclude for the second question.
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75308

I tried a ranking question followed by a multiple choice using an array_filter_exclude. It never worked. The multiple choice question always came up empty.
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75313

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Here's a working example of using multiple choice and array_filter_exclude: demo192.limesurvey.org/index.php?sid=69124&newtest=Y&lang=en

The first page shows using multiple choice to select the classes, followed by array_filter_exclude to get feedback on the unselected classes.

The second page tries the same thing with a ranking style question. Ranking and array_filter can work fine, as in this example: demo192.limesurvey.org/index.php?sid=82898&lang=en

For array_filter_exclude, there is no automatic way to get the names of the unselected classes to display, since their order depends upon the order selected in the ranking question. If we implement sub-question-level relevance in the future, it could control the display; but that is several months away.

So, if you can live with the approach taken on the first page, you can avoid the need for a JavaScript work-around.
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75316

I'm getting an error and "We are sorry but you don't have permissions to do this" on both the links.
The administrator has disabled public write access.

Re: Require multiple answers of a specific option in an array? 2 years 5 months ago #75317

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
You have to login at this link first: demo192.limesurvey.org/admin/admin.php

Details can be found here: www.limesurvey.org/en/demo
Last Edit: 2 years 5 months ago by TMSWhite.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image