Welcome to the LimeSurvey Community Forum

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

Multiple Numeric Suffixes

  • rickyd
  • rickyd's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #127484 by rickyd
Multiple Numeric Suffixes was created by rickyd
Hello,

I'm trying to create a multiple numeric input type question. Each sub question will need it's own unique suffix but as far as I can tell, this is not possible as the only suffix option I could find adds the same suffix to every sub question. Is there a way to get around this?

Thank you,

rickyd
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago - 8 years 6 months ago #127518 by tpartner
Replied by tpartner on topic Multiple Numeric Suffixes
You can try adding something like this to the question source:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function(){
    $('#question'+qID+' li.question-item:eq(0) span.input').append('per minute');
    $('#question'+qID+' li.question-item:eq(1) span.input').append('per hour');
    $('#question'+qID+' li.question-item:eq(2) span.input').append('per day');
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 6 months ago by tpartner.
The topic has been locked.
  • rickyd
  • rickyd's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #127536 by rickyd
Replied by rickyd on topic Multiple Numeric Suffixes
Thank you for responding! I'm having a little trouble adapting that code to my survey, what would I need to change in that code to get it to work with my specific question code structure?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #127543 by tpartner
Replied by tpartner on topic Multiple Numeric Suffixes
The code should work as-is.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • rickyd
  • rickyd's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #127546 by rickyd
Replied by rickyd on topic Multiple Numeric Suffixes
It doesn't seem to be working as is. It's entered in the source area of the question and I've gotten javascript to work on this server before.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #127547 by tpartner
Replied by tpartner on topic Multiple Numeric Suffixes
My mistake, I have typos in the code. It should be:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function(){
    $('#question'+{QID}+' li.question-item:eq(0) span.input').append('per minute');
    $('#question'+{QID}+' li.question-item:eq(1) span.input').append('per hour');
    $('#question'+{QID}+' li.question-item:eq(2) span.input').append('per day');
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...-3-4.lss
File Size:16 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch, rickyd
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #127561 by holch
Replied by holch on topic Multiple Numeric Suffixes
Hehehehe, had tried it as well and it didn't work for me either, until I changed qID with the actual ID of the question id. Tried it with the question code first, then checked the source code and saw that the number is used.

But this is of course the better solution... ;-)

Works like a charm now, even in my custom template.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: rickyd
The topic has been locked.
  • rickyd
  • rickyd's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #127604 by rickyd
Replied by rickyd on topic Multiple Numeric Suffixes
This is great and it works like a charm!! Thank you so much.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose