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

TOPIC: Find 3 highest or lowest rated options in Array (Numbers) question?

Find 3 highest or lowest rated options in Array (Numbers) question? 1 year 2 weeks ago #99066

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
Oh, one other note - I set the Array (numbers) question to display answers in random order.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Find 3 highest or lowest rated options in Array (Numbers) question? 1 year 4 days ago #99411

  • cberghoff
  • cberghoff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
Hey Tony,

Thanks for all your help. Of course, my dissertation committee requested a change, but I was able to modify your code (I only ended up needing the bottom 3).

The js works perfectly, as long as both the number array and checkbox questions are visible. I tried putting the js in an equation question and that worked when hidden, but not if I hid either of the other two items. Indeed, the source code does not include the non-equation-type questions that are set to always hide from users, so obviously the script won't run if included in, or find the items it is looking for, when items are hidden.

I'm working on hiding the questions using CSS (so far unsuccessfully), but this really seems to be an oversight in LS. Shouldn't 'always hide from users' just set the style to display: hidden and perhaps modify the 'required' property, rather than remove the item from the source? Seems that others are expecting a different behavior as well (www.limesurvey.org/en/forum/design-issue...ding-questions#99067) and your comments here lead me to believe you expected something different too.

Any suggestions?

Thanks,
Chris
The administrator has disabled public write access.

Find 3 highest or lowest rated options in Array (Numbers) question? 1 year 4 days ago #99412

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4139
  • Thank you received: 767
  • Karma: 348
Yeah, I really never understood the thinking behind the "always hide" setting either.

You can hide the multiple-options question(s) with JavaScript.

After this line:
var bottomQID = $(bottomQ).attr('id').split('question')[1];


Add this:
		// Hide the multiple-options questions
		$(topQ).hide();
		$(bottomQ).hide();
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Find 3 highest or lowest rated options in Array (Numbers) question? 1 year 4 days ago #99414

  • cberghoff
  • cberghoff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
I have the question id, so I'm using ...

$('#question10426').hide();

etc., in a hidden equation question at the beginning of the group, but now I need to click the next button at the end because an empty group is showing to the user :(

Do you know a quick way to do this?

Chris
The administrator has disabled public write access.

Find 3 highest or lowest rated options in Array (Numbers) question? 1 year 4 days ago #99417

  • cberghoff
  • cberghoff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 12
  • Karma: 0
Never mind, I got it from one of your earlier posts. I'll also post a copy of the group with a description so others can use in the future.

Thanks again Tony. You've really been a lifesaver on this!!

Chris
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.127 seconds
Donation Image