- Posts: 40
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
fix an answer on 1st possition in randomized array
- DanielVN
- Topic Author
- Offline
- Senior Member
Less
More
4 years 5 months ago #190561
by DanielVN
fix an answer on 1st possition in randomized array was created by DanielVN
Hi All,
I have a survey where for the following list of answers in an array question I need to show the first answer (in blue) always at 1st possition and all others should be randomized:
Value-for-money ratio of fruit and vegetable products
Reliable and consistent quality of fruit and vegetable products
Good taste of fruit and vegetable products
Appetizing appearance of fruit and vegetable products
Long shelf-life of fruit and vegetable products at home
Information about origins of fruit and vegetable products
A large selection of fruit and vegetable products
Promotional offers for fruit and vegetables (e.g. leaflet-promotions)
The availability of fruit and vegetable products (few gaps in shelves)
The availability of promoted fruit and vegetable special offers.
The selection of organic fruit and vegetable products
The selection of regional fruit and vegetable products
The selection of exotic fruit and vegetable products (e.g. pomegranate, physalis, kaki)
The selection of snack products and pre-cut fruits and vegetables for instant consumption (e.g. freshly cut pineapple)
The selection of seasonal fruit and vegetable products (e.g. asparagus in spring and pumpkins in autumn)
The selection of different packaging and serving sizes for fruit and vegetable products
The selection of loosely fruits and vegetables
An attractive selection of private labels for fruit and vegetable products
The availability of innovative products (e.g. red basil, avocado-lime-chili-mix for Guacamole, etc.)
The cleanliness and hygiene of the fruit and vegetable section
An appealing presentation of products in the fruit and vegetable section
An inviting atmosphere in the fruit and vegetable section
Please advise how this can be achieved?
The question is Array and i'm using version 2.73
Thank you
I have a survey where for the following list of answers in an array question I need to show the first answer (in blue) always at 1st possition and all others should be randomized:
Value-for-money ratio of fruit and vegetable products
Reliable and consistent quality of fruit and vegetable products
Good taste of fruit and vegetable products
Appetizing appearance of fruit and vegetable products
Long shelf-life of fruit and vegetable products at home
Information about origins of fruit and vegetable products
A large selection of fruit and vegetable products
Promotional offers for fruit and vegetables (e.g. leaflet-promotions)
The availability of fruit and vegetable products (few gaps in shelves)
The availability of promoted fruit and vegetable special offers.
The selection of organic fruit and vegetable products
The selection of regional fruit and vegetable products
The selection of exotic fruit and vegetable products (e.g. pomegranate, physalis, kaki)
The selection of snack products and pre-cut fruits and vegetables for instant consumption (e.g. freshly cut pineapple)
The selection of seasonal fruit and vegetable products (e.g. asparagus in spring and pumpkins in autumn)
The selection of different packaging and serving sizes for fruit and vegetable products
The selection of loosely fruits and vegetables
An attractive selection of private labels for fruit and vegetable products
The availability of innovative products (e.g. red basil, avocado-lime-chili-mix for Guacamole, etc.)
The cleanliness and hygiene of the fruit and vegetable section
An appealing presentation of products in the fruit and vegetable section
An inviting atmosphere in the fruit and vegetable section
Please advise how this can be achieved?
The question is Array and i'm using version 2.73
Thank you
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 5 months ago #190566
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic fix an answer on 1st possition in randomized array
Can you attach a small sample survey (.lss file) containing only that question?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DanielVN
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 1
4 years 5 months ago #190608
by DanielVN
Replied by DanielVN on topic fix an answer on 1st possition in randomized array
Hi TPartner,
Tahnk you. Please find attached the sample survey.
Cheers
Daniel
Tahnk you. Please find attached the sample survey.
Cheers
Daniel
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 5 months ago - 4 years 5 months ago #190610
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic fix an answer on 1st possition in randomized array
Initiate random order in the question settings and add a script like this to the question source:
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // The sub-question code to be fixed in the first position var fixedCode = '1'; var qID = '{QID}'; // Move the sub-question $('#question'+qID+' table.subquestion-list tbody:eq(0)').prepend($('#question{QID} tr.answers-list[id$="X'+qID+fixedCode+'"]')); // Fix up the row background colours $('#question'+qID+' tr.answers-list').each(function(i){ $(this).removeClass('array1, array2'); if(i % 2 == 0) { $(this).addClass('array1'); } else { $(this).addClass('array2'); } }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 5 months ago by tpartner.
The topic has been locked.