Ranking question with drag&drop

More
5 years 5 months ago #80973 by eneldo
eneldo created the topic: Ranking question with drag&drop
Hello everybody,

I have a problem with implementation drag'n'drop functionality into my survey. I am doing as it is described here: docs.limesurvey.org/tiki-index.php?page=...ag_and_Drop_Rankings

- I set "Filter HTML for XSS" to "Off"
- I modify template.js with code provided in the link (wheter i tried to paste the code at the end of the file or in the middle, it doesn't make any difference)
- I paste code in the source of the ranking question (is SGQA for ranking question <survey number>X<group number>X<question number>?)
- I modify template.css with code provided in the link

and despite that the question is still usual ranking question, not ranking question with d&d.

Please help. I'm not very good at programming so I simply paste the code. (and yeah, i know d&d functionality is only a workaround but maybe someone can tell me if I'm doing sth wrong).

Thanks.

Please Log in to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #80976 by tpartner
tpartner replied the topic: Ranking question with drag&drop
Where the workaround says "replace "QQ" with the ranking question ID", it means only the ID, not the full SGQA.

Use just this:


Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 5 years 5 months ago by tpartner.
The following user(s) said Thank You: eneldo

Please Log in to join the conversation.

More
5 years 5 months ago #80978 by eneldo
eneldo replied the topic: Ranking question with drag&drop
damn you :)

it works!

i thought i was trying to do that way at the beginning, but obviously i placed the number with the id. i was mistaken with the link to the description of SGQA.

many many thanks. now i can conduct my conjoint survey :)
it is great that you act so fast on this forum.

Please Log in to join the conversation.

More
5 years 5 months ago #81005 by eneldo
eneldo replied the topic: Ranking question with drag&drop
hey, it's me again.

i need your help with one other thing. could you tell me which is the best way to let text in dragndrop boxers be listed. editing in html code doesn't make look my box what i want to.

i mean i want the box look like this:

"offer 1

attribute 1: a
attribute 2: a
etc."

and this is how i fullfil the ranking answer.
but all i can get is the box which looks like q1, option3 in here: docs.limesurvey.org/tiki-index.php?page=...rsion_1.90_and_newer

which is the easiest way to achieve what i want.

thanks in advance.

Please Log in to join the conversation.

More
5 years 5 months ago #81036 by tpartner
tpartner replied the topic: Ranking question with drag&drop
I'm afraid I don't know what you want.

Can you provide illustrations?

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
5 years 5 months ago - 5 years 5 months ago #81046 by eneldo
eneldo replied the topic: Ranking question with drag&drop
ok, once again.

i want to conduct conjoint type research in which we present different job offers. there will be 16 offers. each offer is described by the set of 6 attributes, such as payment, days of work etc. people who will be examined have to compare offers and rank them from the one their like the best.

now, i want offers to be legible. i want each attribute in the new line as i present in the previous post:

""offer 1

attribute 1: a
attribute 2: a"

i can't achieve this with the html editor of the ranking answers (<br> doesn't work). all i can get is as i present on the picture





everything is in constant line which turns into another line with the end of the width of the box, and i want to have each attribute in the new line - in this case for offer 8:

"OFERTA 8

wynagrodzenie: 15zł/h
rodzaj umowy: cywilnoprawna
etc."
Attachments:
Last Edit: 5 years 5 months ago by eneldo.

Please Log in to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #81050 by tpartner
tpartner replied the topic: Ranking question with drag&drop
Ah. I see. No, you can't use HTML when editing the answers because they are initially loaded into dropdown select elements which don't accept HTML.

Try this:

Add a period to your answers where you want linebreaks - "OFERTA 8.wynagrodzenie: 15zł/h.rodzaj umowy: cywilnoprawna.etc."

And then, in the code, change this line:
var liCode = '<li class="ui-state-default" id="choice_' + $(this).attr("value") + '">' + this.text + '</li>'

To this:
var liCode = '<li class="ui-state-default" id="choice_' + $(this).attr("value") + '">' + $(this).html().replace(/,/g,'<br />') + '</li>'


The new code will find all periods in the rank choices and replace them with <br /> elements.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 5 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #81052 by tpartner
tpartner replied the topic: Ranking question with drag&drop
Sorry, made a mistake in my code - use this:
var liCode = '<li class="ui-state-default" id="choice_' + $(this).attr("value") + '">' + $(this).html().replace(/\./g,'<br />') + '</li>'

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 5 months ago by tpartner.

Please Log in to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #81058 by eneldo
eneldo replied the topic: Ranking question with drag&drop
and one more question (stupid, i presume):

where can i find this code? not in the ranking answer, not in the html of the site with question, not in the exported lsq or lss file. so where?
Last Edit: 5 years 5 months ago by eneldo.

Please Log in to join the conversation.

More
5 years 5 months ago #81059 by tpartner
tpartner replied the topic: Ranking question with drag&drop
It's in the workaround code you copied to template.js.

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.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!