random order of answer categories, except for...

More
4 years 8 months ago #83721 by Schroder101
Ok I realized I also need another tweak

in another question with 13 answers i need to keep the first two answers and the last answer static and also retain the 'other' option at the very end.

I edited the code just by adding another couple of lines see attached which sort of worked however I'm not sure how to make 'other' option show up last.

any suggestions?
Attachments:

Please Log in to join the conversation.

More
4 years 8 months ago #83750 by tpartner
Try this to place the "Other" at the end of the list:
$( 'input#answer' + sID + 'X' + gID + 'X' + qID + 'othercbox' ).parent().appendTo($( '#question' + qID + ' td.answer ul' ));

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Schroder101

Please Log in to join the conversation.

More
4 years 8 months ago #83771 by geejay76
All of these tips are proving very helpful - thanks!

I've been unsuccessfully trying to create a randomisation for a list of 10 attributes with option 10 being a "none of the above" option. In addition to these 10 attributes I also want to include an other option.

I am trying to set up the order of the list so that the first 9 attributes are randomised, then the Other option is displayed, then None at the bottom.

At the moment I can get the randomisation working, but I can;t seem to get the None to lock at the bottom.

Any help would be much appreciated.

Please Log in to join the conversation.

More
4 years 8 months ago #83772 by Schroder101
Ok that worked thanks!

Please Log in to join the conversation.

More
4 years 8 months ago #83773 by Schroder101
Just replace this line in the code posted above - replacing the bit were it calls the first answer only and make sure the other option is activated should work

// Place answer no 10 last below 'other'
$('input#answer' + sID + 'X' + gID + 'X' + qID + 10 + '' ).parent().appendTo($( '#question' + qID + ' td.answer ul' ));

Please Log in to join the conversation.

More
4 years 5 months ago #86690 by arielmosto
Dear Tony:

I need the same for the Ranking question type.

Is that possible?
I tried this same code, but does not work.

Thank you very much ! Regards ! Ariel

Please Log in to join the conversation.

More
4 years 5 months ago #86691 by tpartner
Ariel, this thread is getting a little convoluted. Do you want to randomize all choices except except the last one or all except the first one.

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
4 years 5 months ago #86692 by arielmosto
Dear Tony, thanks.

I need to randomize all choices except the last one.

Regards !

Please Log in to join the conversation.

More
4 years 5 months ago #86697 by tpartner
I think the easiest way to achieve that would be to...

1) Append the answer code of the last item with "_l"


2) In the ranking question, set "Random answer order" to "Yes"


3) Add the following script to the source of the ranking question. Replace "QQ" with the ranking question ID .
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qID = QQ;
 
		$('#question'+qID+' .rank.label select').append($('#question'+qID+' .rank.label option[value$="_l"]'));
	});
 
</script>

Cheers,
Tony Partner

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

Please Log in to join the conversation.