Welcome, Guest
Username: Password: Remember me

TOPIC: Highlight a single column in an array

Highlight a single column in an array 4 months 3 weeks ago #102017

  • jozi
  • jozi's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Hi,

I'm currently trying to highlight a column in an array (= question type). For example, I would like to have a red background, or a red border, for one of several response options (= columns) across all items (= rows). Is there any way to accomplish this in LimeSurvery (I am using V 1.92). I would be thankful for any suggestions.

Best,
The administrator has disabled public write access.

Highlight a single column in an array 4 months 3 weeks ago #102030

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
Every table cell has an answer-code-specific class - answer_cell_00[answer code].

So, if you wanted to highlight the column with answer code "2", you could add something like this to the end of template.css (where "12345" is the question code.
#question12345 .answer_cell_002 {
  background: pink;
}

Capture3_2013-11-27.PNG


Capture4_2013-11-27.PNG
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: 4 months 3 weeks ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: jozi

Highlight a single column in an array 4 months 3 weeks ago #102040

  • jozi
  • jozi's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Thank you very much, this looks perfect to me. Unfortunately, I was not able to reproduce this with my own survey. I assume this is because I am not familiar with css. What I did is the following: I included the following text at the end of the template.css file:

#page1 .answer_cell_009 {
background: #777777;
border-left: 1px solid black;
}

What I hoped for was that the colum of answer code "9" (as defined in the "edit answer option" menue) for the array question with the code "page1" (as defined in the "edit current question" menue) would be displayed with a grey background and a black border at the left. I was not sure whether it would be necessary to specify the ID of the survey, question group, or question. Note that my question "page1" has 20 subquestions (i.e., rows). Maybe you have an idea what went wrong?
The administrator has disabled public write access.

Highlight a single column in an array 4 months 3 weeks ago #102041

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
You need to use the question ID, not code. So, "page1" should be replaced with the question ID.

Capture_2013-11-27.PNG
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: 4 months 3 weeks ago by tpartner.
The administrator has disabled public write access.

Highlight a single column in an array 4 months 3 weeks ago #102049

  • jozi
  • jozi's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
Ok, I see. I tried it again, this time replacing "page1" with "1553" (= the question ID), and also with "question1553" or "ID1553", but it didn't work. I also tried other answer codes (e.g., ".answer_cell_001"), and using another template. Not sure what is going wrong here. Maybe there are some general settings or features of the survey that interfere with this command at the end of the template.css file?
The administrator has disabled public write access.

Highlight a single column in an array 4 months 3 weeks ago #102051

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 3813
  • Thank you received: 683
  • Karma: 328
If the question ID is 1553, the CSS should be:
#question12345 .answer_cell_009 {
  background: #777777;
  border-left: 1px solid black;
}


Can you activate a test survey for me to see?
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.
The following user(s) said Thank You: jozi

Highlight a single column in an array 4 months 2 weeks ago #102103

  • jozi
  • jozi's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 7
  • Karma: 0
It is working now! The problem was that I did not activate the survey. After activating it, the effects of changing the css file were visible.

thank you for your help!
The administrator has disabled public write access.

Highlight a single column in an array 4 months 2 weeks ago #102106

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2444
  • Thank you received: 254
  • Karma: 94
If the survey is activated or not usually should have no impact on the display of templates and changes in the CSS.

I guess what happened was, that you did not empty the cache and so you saw only the old version, once the survey was activated, you used a different link and the results became visible, because the cache wasn't used.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.127 seconds
Donation Image