Welcome to the LimeSurvey Community Forum

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

List (ratio) with prefix and sufix for numerical input?

  • nhotovas
  • nhotovas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago - 6 years 7 months ago #157607 by nhotovas
Hi all,

I have a List(Radio) question, and one of the options/answers should have a possibility for inputting a number. With other words, one option should be i.e. „About [HERE INPUT A NUMBER] costumers order online. “
It should look like this:


I temporary resolved this with the option "other", but the problem is that the number should be between some words and not at the end.
Do you have any ideas how to add suffix on "other“ or any other solution to resolve this?

Thanks for help.
Last edit: 6 years 7 months ago by nhotovas.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago #157614 by tpartner
You should be able to move the input via JavaScript.

What LimeSurvey version are you using?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • nhotovas
  • nhotovas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #157619 by nhotovas
Thank you for your response. I assumed it could be solved with JavaScript, and I tried but did not manage... but honestly I am not an expert for JavaScript :(
I would appreciate a lot your help if you had an example for sharing.

I use version 2.05+ Build 141229.
Regards!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 7 months ago - 6 years 7 months ago #157623 by tpartner
1) Insert something like this as the "Label for 'Other:' option":

Code:
About <span class="value">x</span> customers order online.

2) Add this script to the question source:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID} .other-item span.value').after($('#question{QID} label[for$="othertext"]')).remove();
  });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...8-15.lss
File Size:16 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 7 months ago by tpartner.
The topic has been locked.
  • nhotovas
  • nhotovas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #157627 by nhotovas
It works!!! Thank you very much!!!
The topic has been locked.
  • nhotovas
  • nhotovas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 3 months ago #161704 by nhotovas
Dear Tony,

In my company have plans to upgrate lime version (probably on 2.7X). So i imported my survey from 2.05 on trial version of lime , just to see how it will works, but unfortunately this code what you recomended doesn't work. It worked perfectly in lime 2.05. Do you have any idea why it shouldn't work on new lime versions? I worry if I don't find solution, becouse users used to have it in this form.
Now it looks like:



Thank you in advance...
Attachments:
The topic has been locked.
More
6 years 3 months ago #161710 by jelo

nhotovas wrote: Do you have any idea why it shouldn't work on new lime versions?

LimeSurvey 2.7X is using a complete different template system. So nearly all workarounds which depended on HTML modification via Javascript need an update. With LS 3.0 the whole templatesystem changes again. So you might wait till LS 3.0 is hitting the street and then start the migration tests.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161727 by holch
I agree with Jelo. If you you are thinking about upgrading now at this point in time, I would wait a little longer until a stable 3.0 is out (was promissed for this year, but I am not sure how realistic this still is). However, we already have Release Candicate 3, so I guess it can only take a few weeks until a stable release will be published. Hopefully this was not such a quick shot and the template system will stay stable for quite some time (but I think it will, because Denis took care of it and I think he is more the "stable" kind of guy anyway). Then it will also be worth to develop own templates and for Tpartner to develop his workarounds.

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

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161732 by tpartner
Yes, I would also wait for 3.x before updating - many many improvements.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • nhotovas
  • nhotovas's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 3 months ago #161747 by nhotovas
Hi all...

thank you for your advices, but the company will gradually upgrade to the 3.0 and for the current needs the upgrade to 2.72.6 will be done now. The other surveys do not have same problem like I am facing with this upgrade, so I must search for some way out and solution for my problem.
Any idea?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago - 6 years 3 months ago #161748 by holch
"but the company will gradually upgrade to the 3.0 and for the current needs the upgrade to 2.72.6 will be done now."
Makes totally sense. Waiting 3 years with upgrades, then, when 2.7x is getting to end of life and 3.0 is about to come out make a quick upgrade to 2.7x.

I assume the next update and upgrade to 3.x is planned in about 2 years, when 4.0 is coming out? ;-)

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

Last edit: 6 years 3 months ago by holch.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161752 by tpartner
This will work for 2.72.5...

1) HTML for the Other label:

Code:
About <span class="post-text"> customers order online.</span>

2) JavaScript:

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#question{QID} input[type="text"]').parent().after('<div class="pull-left post-text-wrapper" style="padding:5px 0 0 5px;" />');
    $('#question{QID} .post-text-wrapper').append($('#question{QID} span.post-text'));
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose