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

More
1 month 3 days ago #167657 by HBanayoti
HBanayoti created the topic: how to reference the comment text of a list-with-comment question
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

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #167658 by Joffm
Joffm replied the topic: how to reference the comment text of a list-with-comment question
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:
<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

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #167660 by HBanayoti
HBanayoti replied the topic: how to reference the comment text of a list-with-comment question
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

Please Log in or Create an account to join the conversation.

More
1 month 3 days ago #167667 by Joffm
Joffm replied the topic: how to reference the comment text of a list-with-comment question
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
Attachments:
The following user(s) said Thank You: HBanayoti

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago #167710 by HBanayoti
HBanayoti replied the topic: how to reference the comment text of a list-with-comment question
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

Please Log in or Create an account to join the conversation.

More
1 month 2 days ago - 1 month 2 days ago #167713 by Joffm
Joffm replied the topic: how to reference the comment text of a list-with-comment question
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".
Last Edit: 1 month 2 days ago by Joffm.
The following user(s) said Thank You: HBanayoti

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!