- Posts: 73
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Character Limit for 'Other' Option
- BBCMResearch
- Topic Author
- Offline
- Senior Member
Less
More
7 years 11 months ago #134861
by BBCMResearch
Character Limit for 'Other' Option was created by BBCMResearch
Hi,
I have a couple of multiple choice questions in my survey that have "Other" Options at the end. My client wants these options to be limited to no more than 150 characters, however I can't figure out where/if I can set a character limit.
Advice?
I have a couple of multiple choice questions in my survey that have "Other" Options at the end. My client wants these options to be limited to no more than 150 characters, however I can't figure out where/if I can set a character limit.
Advice?
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
7 years 11 months ago #135042
by first
Survey Designer and Programmer
Replied by first on topic Character Limit for 'Other' Option
Survey Designer and Programmer
The following user(s) said Thank You: BBCMResearch
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
7 years 11 months ago #135070
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Character Limit for 'Other' Option
You can add something like this to the question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input.text').attr('maxlength', '150'); }); </script>
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: BBCMResearch, nique
The topic has been locked.
- BBCMResearch
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 73
- Thank you received: 1
7 years 11 months ago #135089
by BBCMResearch
Replied by BBCMResearch on topic Character Limit for 'Other' Option
Thank you both!
The topic has been locked.
- nique
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
6 years 11 months ago #153380
by nique
Replied by nique on topic Character Limit for 'Other' Option
Apologies for asking this on an old thread, but is it possible to add this to a List - Other option?
I have used the other script for Multiple choice questions and it works great! But it does not appear to work for a dropdown list.
Thanks in advance for any help.
I have used the other script for Multiple choice questions and it works great! But it does not appear to work for a dropdown list.
Thanks in advance for any help.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 11 months ago #153407
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Character Limit for 'Other' Option
Try this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#question{QID} input[type="text"]').attr('maxlength', '150'); }); </script>
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: nique
The topic has been locked.
- nique
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
6 years 11 months ago #154147
by nique
Replied by nique on topic Character Limit for 'Other' Option
Thank you! Works a treat.
Am I correct in assuming that this - [type="text"] - identifies the specific Other text input?
Am I correct in assuming that this - [type="text"] - identifies the specific Other text input?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
6 years 11 months ago #154167
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Character Limit for 'Other' Option
Yes, the [type="text"] selector will target all short-text inputs in that question. Those inputs normally have an associated class "text" (used in the previous workaround) but that class seems to have been omitted in this question type.
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: nique
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
6 years 9 months ago #156914
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Character Limit for 'Other' Option
To be sure it woirk without javascript (never trust user):
in em_validation_q
manual.limesurvey.org/Question_type_-_Mu...28em_validation_q.29
Code:
strlen(Multi_other.NAOK) < 150
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- reginab
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
3 years 10 months ago - 3 years 10 months ago #200276
by reginab
Replied by reginab on topic Character Limit for 'Other' Option
Sorry added in duplicate by mistake
Last edit: 3 years 10 months ago by reginab.
The topic has been locked.
- reginab
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
3 years 10 months ago - 3 years 10 months ago #200277
by reginab
Replied by reginab on topic Character Limit for 'Other' Option
Hi,
I have tried this out but can't seem to get it working, I wonder would you mind taking a look?
Here is my question:(see Capture1.png)
It is called q313_other (see Capture2.png)
Here is the code I added:(see Capture3.png)
However I can add more than 4 chars (see Capture4.png)
Any help would be much appreciated
Thanks,
R
I have tried this out but can't seem to get it working, I wonder would you mind taking a look?
Here is my question:(see Capture1.png)
It is called q313_other (see Capture2.png)
Here is the code I added:(see Capture3.png)
However I can add more than 4 chars (see Capture4.png)
Any help would be much appreciated
Thanks,
R
Attachments:
Last edit: 3 years 10 months ago by reginab.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 10 months ago #200279
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Character Limit for 'Other' Option
Change:
To:
Code:
input.text
To:
Code:
input[type="text"]
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.