Welcome, Guest
Username: Password: Remember me

TOPIC: Slider question type with options on either sides of it

Slider question type with options on either sides of it 3 years 5 months ago #58982

Hi,

I am pretty new on Limesurvey, and slowly getting my hands dirty with it.

Looking at the slider question type, i can do a question with a slider bar, yet the structure is as such:

QUESTION TITLE
ANSWER 1
|---X-| (the dots being the slider with a rating system from 1 to 5)
ANSWER 2
|-x---|
and so on...

What i am actually trying to get is:

QUESTION TITLE
ANSWER 1 |---X-| ANSWER 2
ANSWER 3 |-X---| ANSWER 4
and so on, where if the survey taker slides the slider(like in the ANSWER 1- ANSWER 2 example) to the fourth (4) rating, ANSWER 1 is scored 4 points and ANSWER 2 is scored 1 point. And as well where both answers are on either side of the slider.

Is there a way to do that?

Thanks in advance for your answers and help.

Ps. i do hope i am making sense...B)

Pat
The administrator has disabled public write access.

Re: Slider question type with options on either sides of it 3 years 5 months ago #58986

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
Not out of the box but you could use a hidden question to collect the data.

Using your example, set up a slider question with 2 slides and use left/right text to display "ANSWER 1", "ANSWER 2". etc. Then you could use JavaScript to detect the position of the slides and populate a hidden multi-numeric question with the correct values for each of the 4 options.
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.

Re: Slider question type with options on either sides of it 3 years 5 months ago #58988

  • tammo
  • tammo's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 36
  • Thank you received: 3
  • Karma: 1
Or could this be what you mean?

survey.toolsforresearch.com/index.php?sid=96552&lang=en

This was done using the question type "multiple numerical input", with the following extra options:

Use slider layout: yes
Slider accuracy: 1
Slider maximum value: 5
Slider left/right text separator:: (please note that I have filled in ":")
Slider minimum value: 1
Slider initial value: [field left empty, important, when question is mandatory]

Then in the subquestions I filled in:
:Not interesting:Very interesting
:Black:White
:Ugly:Beautiful

I recently struggled with this...
Last Edit: 3 years 5 months ago by tammo.
The administrator has disabled public write access.

Re: Slider question type with options on either sides of it 3 years 5 months ago #58989

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
Yup, that would set up the slider portion of my solution.

You could then use JavaScript to calculate the values for each option. If I understand correctly, something like:

ANSWER 1 = slider 1 value
ANSWER 2 = (slider 1 maximum) - (slider 1 value)
ANSWER 3 = slider 2 value
ANSWER 4 = (slider 2 maximum) - (slider 2 value)
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.

Re: Slider question type with options on either sides of it 3 years 5 months ago #59032

Thx guys for being so quick :)

I ll give it a try.

Any idea where i could find a GOOD start-up guide for learning JavaScript?...since i have no clue how to implement JS

Thx
The administrator has disabled public write access.

Re: Slider question type with options on either sides of it 3 years 5 months ago #59045

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
Any idea where i could find a GOOD start-up guide for learning JavaScript?
Try these:

- www.peachpit.com/store/product.aspx?isbn=0321602676
- www.peachpit.com/store/product.aspx?isbn=0321647491
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.

Re: Slider question type with options on either sides of it 3 years 5 months ago #59053

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
In the meantime try this:

1) Set up your survey to use JavaScript.

2) Create the slider question with left and right text as explained above.

3) On the same page (in the same group), create a multi-numeric question with all options listed separately (we'll hide this with JavaScript later).

4) Add the following script to the source of one of the questions. Replace "SS" with the slider question ID and "HH" with the multi-numeric (hidden) question ID.

The script interrupts the next/submit function, finds the position of each slider and populates the hidden question appropriately.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		var qSlider = SS;
		var qHidden = HH;
 
		// Hide the hidden question
		$('#question'+qHidden).hide();
 
		// Interrupt next/submit function
		$('form#limesurvey').submit(function(){
 
			// Loop through the sliders
			$('#question'+qSlider+' .multinum-slider').each(function(i) {
				var index = i;
				if (index > 0) {
					index = index*2;
				}
				// Find the slider value
				var sliderMax = $('input[id^="slider-param-max"]', this).val();
				var sliderVal = $('div[id^="slider-callout"]', this).text();
				// Populate the appropriate hidden question input
				$('#question'+qHidden+' input.text:eq('+index+')').val(sliderVal);
				$('#question'+qHidden+' input.text:eq('+(index+1)+')').val(Number(sliderMax - sliderVal));
			});
			return true;
		});
 
	});
 
</script>

This is what it would look like if the multi-nmeric were not hidden.


Untitled-1.gif
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.
Last Edit: 3 years 5 months ago by tpartner.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.130 seconds
Donation Image