- Posts: 348
- Thank you received: 41
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Workaround for N/A in slider array
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
6 years 7 months ago #158057
by Jmantysalo
Workaround for N/A in slider array was created by Jmantysalo
Any suggestions for a workaround to add N/A -checkbox to a slider array? Should be something like
Do you like following foods:
Tomatoes: |---o--| [ ] Have never eaten tomatoes
Potatoes: |-o----| [ ] Have never eaten potatoes
Do you like following foods:
Tomatoes: |---o--| [ ] Have never eaten tomatoes
Potatoes: |-o----| [ ] Have never eaten potatoes
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
6 years 7 months ago - 6 years 7 months ago #158060
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Workaround for N/A in slider array
Hi,
you should read this.
www.limesurvey.org/de/foren/design-issue...with-yes-no-question
It's not exactly your problem, but you may get an idea and can adapt it.
A different approach - if you don't be able to wait for an answer - is:
1st question (multi): Which vegetables have you eaten?
2nd question (slider): How do you like...? (only eaten vegatables are displayed)
Best regards
Joffm
you should read this.
www.limesurvey.org/de/foren/design-issue...with-yes-no-question
It's not exactly your problem, but you may get an idea and can adapt it.
A different approach - if you don't be able to wait for an answer - is:
1st question (multi): Which vegetables have you eaten?
2nd question (slider): How do you like...? (only eaten vegatables are displayed)
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 7 months ago by Joffm.
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
6 years 7 months ago #158066
by Jmantysalo
Replied by Jmantysalo on topic Workaround for N/A in slider array
Thanks! It seems that the example on limesurvey_survey_716649.lss in the thread you linked is a perfect starting point. I just changed
to
and it seems to work.
To your second suggestion: The research team asking this want to mimic a paper form so closely as possible, so I try to avoid modifications. (Also, this LimeSurvey seems like a great product, so it would be nice to learn it deeply.)
Code:
// Insert the radios $(this).parent().addClass('radio').append('<span class="inserted-radio-wrapper">\ <input id="'+thisID+'-Y" class="radio" value="Y" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\ <label class="control-label radio-label" for="'+thisID+'-Y">Yes</label>\ </span>\ <span class="inserted-radio-wrapper">\ <input id="'+thisID+'-N" class="radio" value="N" name="'+thisID.replace(/answer/, '')+'_radio" type="radio">\ <label class="control-label radio-label" for="'+thisID+'-N">No</label>\ </span>'); // Initial radio states $(this).closest('td').find('input[type="radio"][value="'+thisValue+'"]').prop('checked', true); }); // Listener on the radios $('.answer-item.column-2 input[type="radio"]', thisQuestion).on('click', function() { var thisInput = $(this).closest('td').find('input[type="text"]'); $(this).closest('td').find('input[type="text"]').val($(this).val()); checkconditions($(thisInput).val(), $(thisInput).attr('name'), 'text'); });
to
Code:
// Insert the checkboxes $(this).parent().addClass('checkbox').append('<span class="inserted-checkbox-wrapper">\ <input id="'+thisID+'-Y" class="checkbox" value="Y" name="'+thisID.replace(/answer/, '')+'_checkbox" type="checkbox">\ <label class="control-label checkbox-label" for="'+thisID+'-Y">En vastaa tähän</label>\ </span>\ '); // Initial checkbox states $(this).closest('td').find('input[type="checkbox"][value="'+thisValue+'"]').prop('checked', false); }); // Listener on the checkboxes $('.answer-item.column-2 input[type="checkbox"]', thisQuestion).on('click', function() { var thisInput = $(this).closest('td').find('input[type="text"]'); $(this).closest('td').find('input[type="text"]').val($(this).val()); checkconditions($(thisInput).val(), $(thisInput).attr('name'), 'text'); });
and it seems to work.
To your second suggestion: The research team asking this want to mimic a paper form so closely as possible, so I try to avoid modifications. (Also, this LimeSurvey seems like a great product, so it would be nice to learn it deeply.)
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
6 years 7 months ago #158108
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Workaround for N/A in slider array
Support feature request
bugs.limesurvey.org/view.php?id=10856
bugs.limesurvey.org/view.php?id=10856
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- Jmantysalo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 348
- Thank you received: 41
6 years 7 months ago #158114
by Jmantysalo
Replied by Jmantysalo on topic Workaround for N/A in slider array
The topic has been locked.