Check out the LimeSurvey source code on GitHub!

Hiding boxes by element ID in ranking question?

More
5 years 7 months ago - 5 years 7 months ago #63527 by tomf
Hello. I have done plenty of reading, and seen how workarounds are done... but still cannot find the solution to what I need to do. I'm pretty sure it is possible.

I have set up a survey, including one 'ranking' type question. We only want to ask for the top three out of 10 possible choices, so I have set 'minimum answers' to 3 in advanced settings for that question, and turned off mandatory.

Now all that is left to do is HIDE the ranking boxes for #4 through #10, so that the user only sees three boxes. I thought that this would be straightforward using the Template Editor.

This is question 4 in my survey, so the ranking boxes have ID's such as RANK_44, RANK_45, etc.

So I edited template.css in an attempt to hide the ranking boxes by their ID, such as this:

#RANK_44 { display: none; }
#RANK_45 { display: none; }
#RANK_46 { display: none; }
#RANK_47 { display: none; }
#RANK_48 { display: none; }
#RANK_49 { display: none; }
#RANK_410 { display: none; }

Unfortunately, this does not work. All 10 boxes are still visible. Either I am making a CSS error, or there is something else that I am missing.

Anyone have a fix for this?

Thank you very much!
Last Edit: 5 years 7 months ago by tomf.

Please Log in to join the conversation.

More
5 years 7 months ago #63597 by tomf
LimeSurvey gurus? developers? anyone?

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #63600 by Ben_V
I don't know exactly the CSS background for the ranking questions, but maybe you've to look
around this kind of CSS properties :nth-child ( :nth-of-type, :first-child, :last-child. etc.).
It could be better in your case than using only #ID{display:none}
You'll find here some resources:
(It's in French but with a lot of graphic examples)

Benoît

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last Edit: 5 years 7 months ago by Ben_V.

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #63627 by DenisChenu
BAD ANSWER :(

Hello,

You can't "hide" option in css i think.

But you can "remove" it with jquery. If your question are question 42 for example, and your choice are A1, A2, A3, A4 and you want to remove the first item. I think you can do something like that in javascript.
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function () {
$("#CHOICES_42 option:eq(0)").remove();
});
</script>

[edit]
Sorry, i didn't read the question .... tpartner have right

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 5 years 7 months ago by DenisChenu.

Please Log in to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #63634 by tpartner
Set "Maximum answers" to 3, not "Minimum answers".

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
5 years 7 months ago #63647 by tomf
tpartner, your solution was exactly what i needed ... i guess i was over-complicating the issue and not seeing the obvious!

thank you very much!

:-)

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form