Welcome to the LimeSurvey Community Forum

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

How to limit the long text answer' box to 1 row?

  • AnnaSSSA
  • AnnaSSSA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #209768 by AnnaSSSA
Dear All, I need to limit to 1 row the answer' box of the long type questions. I see only the option to limit the number of rows to see or the characters' number...nothing more. Of course, I'm missing to see function that make possible to activate this limitation.
My survey is already running online, and I can do only the changes admitted in this stage.
Thanks.
Anna
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209770 by DenisChenu
Replied by DenisChenu on topic How to limit the long text answer' box to 1 row?
Did you try with row : 1 in advanced setting ?

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.
  • AnnaSSSA
  • AnnaSSSA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #209771 by AnnaSSSA
I am unable to see this section within the question's page...is it somewhere else?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209772 by holch

I need to limit to 1 row the answer' box of the long type questions.

Wouldn't this make it basically the short text question type?!

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: DenisChenu
The topic has been locked.
  • AnnaSSSA
  • AnnaSSSA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #209773 by AnnaSSSA
I completely agree with you... but I am trying to remedy to a wrong setting of the question we did.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209774 by Joffm
Hi,
unfortunately you did not mention the LimeSurvey version you are using.

As the user interface changed with each new major version we can't show you the exact place.
But in version 3.x. you find it here:
"Display":


Version 2.50/2.73 in "Advanced settings"

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • AnnaSSSA
  • AnnaSSSA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #209775 by AnnaSSSA
I'm using a version 3.x and I confirm to see the Display row setting. I used it but it allows to reduce the number of rows to see, not the number of rows that can be filled. Of course this solution can help me to discourage extensive compilation.
Thanks for your support!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209778 by tpartner
You can add this script to the question source. It will will hide the long textarea and insert a short text input. Values entered in that text input will be loaded into the hidden textarea.

Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
 
    // Hide the textarea
    $('.answer-item textarea', thisQuestion).hide();
 
    // Insert short text input
    $('.answer-item', thisQuestion).append('<input class="form-control inserted-input" type="text">');
    $('.inserted-input', thisQuestion).val($('.answer-item textarea:eq(0)', thisQuestion).val());
 
    // Listener on inserted input
    $('.inserted-input', thisQuestion).on('keyup change', function(i) {
      $('.answer-item textarea', thisQuestion).val($(this).val()).trigger('change');
    });
  });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...5771.lss
File Size:20 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • AnnaSSSA
  • AnnaSSSA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #209786 by AnnaSSSA
Great, thanks!
With a script I can transform the long text question in a Yes/No question?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209788 by Joffm
Hi,
please do not forget:
all types of "text" questions (short, long, huge) have the same underlying data type in the MySQL database ("text", that is 65000 characters).
This means, I can enter in a short text field the same amont of characters as in the other.
As you see here




If you really want to limit the length of the answer you have to validate, like strlen(self) le 300

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #209794 by DenisChenu
Replied by DenisChenu on topic How to limit the long text answer' box to 1 row?

AnnaSSSA wrote: Great, thanks!
With a script I can transform the long text question in a Yes/No question?

Sometimes : best is to deactivate your survey temporary …
You can keep previous value with VV export/import or directly by deactivated table …

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.

Lime-years ahead

Online-surveys for every purse and purpose