Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

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

Insert either the answer to a question, or the corresponding Other 5 years 3 months ago #64947

  • vadindot
  • vadindot's Avatar
  • Offline
  • Senior Lime
  • Posts: 55
  • Thank you received: 1
  • Karma: 0
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.
The administrator has disabled public write access.

Insert either the answer to a question, or the corresponding Other 5 years 3 months ago #64949

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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.
The administrator has disabled public write access.

Insert either the answer to a question, or the corresponding Other 5 years 3 months ago #64951

  • vadindot
  • vadindot's Avatar
  • Offline
  • Senior Lime
  • Posts: 55
  • Thank you received: 1
  • Karma: 0
so like this? (44 being the "Other" response)
prevAnswers = prevAnswers.replace(/Other/, {INSERTANS:11111X22X44});
The administrator has disabled public write access.

Insert either the answer to a question, or the corresponding Other 5 years 3 months ago #64958

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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.
The administrator has disabled public write access.
Time to create page: 0.210 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form