Welcome to the LimeSurvey Community Forum

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

Text field within text

  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #205021 by Anika___
Text field within text was created by Anika___
Hello all,

I work with (multiple) dropdown elements within texts – thanks to the help of the forum that works great.

My question: Can I replace the dropdown element in this construction by a simple text box, i.e. have one / multiple text box(es) within one/two/three.. sentences?

I attach a sample survey for the dropdown solution as well as a screenshot and would be happy for help on how to replace the dropdown element with a simple text box element... (if at all possible).

PS: I have tried the prefix / suffix and css fifty-fifty solution, it works but does not solve my problem in this case.

Thank you
Anika

Version 2.67.3+170728


File Attachment:

File Name: Sample For...0909.lss
File Size:22 KB
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205022 by Joffm
Replied by Joffm on topic Text field within text
Like this?


Change all question types to "short free text".
In the script exchange all "select" to "input".
In the css part of the script set the desired width.
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready',function(){
    var thisSelect = $('#question{QID} input[id^="answer"]:eq(0)');
    var secondSelect = $('#question{QID}').nextAll('[id^="question"]:eq(0)').find('input[id^="answer"]:eq(0)');
    var thirdSelect = $('#question{QID}').nextAll('[id^="question"]:eq(1)').find('input[id^="answer"]:eq(0)');
 
    // Move the first dropdown
    $('#question{QID} .inserted-dropdown:eq(0)').append(thisSelect);
    // Move the second dropdown
    $('#question{QID} .inserted-dropdown:eq(1)').append(secondSelect);
    // Move the second dropdown
    $('#question{QID} .inserted-dropdown:eq(2)').append(thirdSelect);
 
    // Hide the next question
    $('#question{QID}').nextAll('[id^="question"]:eq(0)').hide();
    // Hide the next question
    $('#question{QID}').nextAll('[id^="question"]:eq(1)').hide();
  });
</script>
<style type="text/css">#question{QID} input {
                display: inline-block;
                margin: 0 0 0 -0.25em;
                width: 17%;
                height: auto;
                padding: 0;
            }
</style>

I did not change the class "inserted-dropdown" though it isn't a dropdown anymore.
Doesn't matter.

And fine tuning is up to you.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Anika___
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205028 by holch
Replied by holch on topic Text field within text

Version 2.67.3+170728

And you should consider an update to LS 3.x LTS (NOT to LS 4.x). Your installation is over 3 years old and not even the latest version of the 2.7x branch.

However, when you update, do NOT update to LS 4.x just yet.

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: Anika___
The topic has been locked.
  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #205045 by Anika___
Replied by Anika___ on topic Text field within text
Yes, exactly like this! I tried it and it works.
Thanks a lot, Joffm!

Best,
Anika
The topic has been locked.
  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #205046 by Anika___
Replied by Anika___ on topic Text field within text
Thanks, holch!
I am using limesurvey within the university server, I will pass on your recommendation!
I have installed quite a lot of workarounds and styles, will they get lost during an update to LS 3x.?

Thanks,
Anika
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205049 by holch
Replied by holch on topic Text field within text

I have installed quite a lot of workarounds and styles, will they get lost during an update to LS 3x.?


They will probably not "get lost", but they probably won't work anymore. So I guess you will not say anything to the university...

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: Anika___
The topic has been locked.
  • Anika___
  • Anika___'s Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 6 months ago #205050 by Anika___
Replied by Anika___ on topic Text field within text
maybe not yet-) it took me quite a while, I just do not have the time to start all over again right now...
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose