Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

how to reference the comment text of a list-with-comment question

  • HBanayoti
  • HBanayoti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #167657 by HBanayoti
Hi All,

This may be very basic or I just can't see it.

I'm trying to find out how to reference two things:
1) the comment text of a list-with-comment question; e.g. Qcode.comment.shown?
2) the help text associated with a question; e.g. Qcode.help.shown?

Your help would be much appreciated.

Thanks
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167658 by Joffm
Hi,

my question is: Whar do you want to do?
Do you want to display the entered text in the comment field in a later question?
Do you want to change the displayed text of the comment field?
E.g:
Code:
<script>
$(function() {
$("#question{QID} .comment label").text("This is my new text for comments");
});
</script>

Do you want to display the help text in a later question?
Do you want to change the displayed help text dynamically?

And - as usual: Which version of LS?

Kind regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • HBanayoti
  • HBanayoti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #167660 by HBanayoti
Hi Joffm,

Thanks for your reply.

1) I want to display the entered text in the comment field in a later question.
2) I want to display the help text in a later question?

My version LS is version 3.7.0

Thanks in advance
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167667 by Joffm
Hi,
1. the entered text in the comment field.
That's easy:
Create a survey with a comment, activate, enter a few respones, and have a look at the answer table.
Here you see the code, you have to use.


Here you see, that you have to use "Q0_comment":


2. the help text. Why do you want to get this? You enter this text when adding a question. So you just can copy it into other questions. This text doesn't change.
Or what is your reason to do this?

Best you send a sample (*.lss) that we see better

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: HBanayoti
The topic has been locked.
  • HBanayoti
  • HBanayoti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 11 months ago #167710 by HBanayoti
Thanks Joffm,

I successfully implemented solution [1] and it worked fine.

For solution [2], referencing the 'Help' text entered, I need that because it contains important descriptive survey content which I would like to re-display later in a text-display question which provides a final summary report. Aesthetically it looks better to include that content in 'Help' field of the question rather the body of the question itself. Nonetheless, for the time being I have shifted the content back into the body of the question as it seems to be the only way to achieve what I'm looking for. However, I think this should make an important feature request for future releases of LS. It should certainly be something fairly easy to develop.

Rgds
Hani
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago - 5 years 11 months ago #167713 by Joffm
Hi,
there are really other more important things.

This (help)text is not dynamic, it is static. It's is something you enter in the "help text" box of each question (or leave it blank)
So it shouldn't be too difficult to copy this text to another place - your summary.

Different from the dynamic text entered by the respondent as the comment. Here you need a reference.

Joffm

P.S.
You could try to retrieve the help text by an ajax call to search the table "[LS]_questions" for the field "help" depending on the questionID.
There is a small example. Just search the forum for "ajax call".

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 11 months ago by Joffm.
The following user(s) said Thank You: HBanayoti
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose