Check out the LimeSurvey source code on GitHub!

Insert either the answer to a question, or the corresponding Other

More
5 years 5 months ago #64947 by vadindot
I have a question with 3 responses and Other.

In several of the follow up questions, I need to insert this answer. If they choose "Other" I need to display the appropriate text (but NOT the word Other which is what happens when I just put in both fields.

Please Log in to join the conversation.

More
5 years 5 months ago #64949 by tpartner
You should be able to replace the value returned by {INSERTANS}. Have a look at this post for inspiration - www.limesurvey.org/en/forum/can-i-do-thi...ifferent-lines#61317

In your case the replace line would look something like:
prevAnswers = prevAnswers.replace(/Other/, 'Your new text');

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 5 months ago #64951 by vadindot
so like this? (44 being the "Other" response)
prevAnswers = prevAnswers.replace(/Other/, {INSERTANS:11111X22X44});

Please Log in to join the conversation.

More
5 years 5 months ago #64958 by tpartner
No. In my code, if "Other" is found in the span element, it will be replaced with "Your new text".

In other words, if {INSERTANS:11111X22X44} returns "Other", then "Your new text" will be inserted in it's place.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

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