Welcome, Guest
Username: Password: Remember me

TOPIC: Ranking question with drag&drop

Ranking question with drag&drop 2 years 5 months ago #80973

  • eneldo
  • eneldo's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #80976

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4356
  • Thank you received: 826
  • Karma: 381
Where the workaround says "replace "QQ" with the ranking question ID", it means only the ID, not the full SGQA.

Use just this:

Capture_2012-05-27.JPG
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: 2 years 5 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: eneldo

Re: Ranking question with drag&drop 2 years 5 months ago #80978

  • eneldo
  • eneldo's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81005

  • eneldo
  • eneldo's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81036

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4356
  • Thank you received: 826
  • Karma: 381
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.

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: Ranking question with drag&drop 2 years 5 months ago #81046

  • eneldo
  • eneldo's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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


example.jpg



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."
Last Edit: 2 years 5 months ago by eneldo.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81050

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4356
  • Thank you received: 826
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 2 years 5 months ago by tpartner.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81052

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4356
  • Thank you received: 826
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 2 years 5 months ago by tpartner.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81058

  • eneldo
  • eneldo's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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: 2 years 5 months ago by eneldo.
The administrator has disabled public write access.

Re: Ranking question with drag&drop 2 years 5 months ago #81059

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4356
  • Thank you received: 826
  • Karma: 381
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image