Welcome to the LimeSurvey Community Forum

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

Hide text box in a multi-text sub-question

  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210277 by Eliott13
Hi. I'm new in the forum. I hope you can bear with me I am working with a survey where I show images in a question of "several short texts" So the person who answers the interview gives a brief description of the images he sees. the problem is that the same images are shown several times in several questions, but in each question a random image will be hidden. so I would like that image that is hidden to respect the position, that is, if image 2 is hidden, that place is respected and it remains blank. Obviously if I put an empty sub-question, it will show me the description box. What I would like to know if there is any way to hide this text box so that it only appends a blank image and the position is respected. I hope I was very clear in my comments. A big hug to all. Elliot
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210301 by tpartner
Replied by tpartner on topic Hide text box in a multi-text sub-question
How are you randomly hiding the images?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210359 by Eliott13
Replied by Eliott13 on topic Hide text box in a multi-text sub-question
Hello,

thanks for reading me,

Images are already hidden by default.

I mean that in each question it is already specified which image to hide.

That is:

P1. remove image 2
P2. remove image 4
P3. remove image 1
P4. remove image 5
P5. remove image 3

I don't do anything, I only remove the image according to the question, but I want this space to be respected so that the interviewee becomes familiar with the position of the images.

Thank you. :)
The topic has been locked.
  • holch
  • holch's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210364 by holch
Replied by holch on topic Hide text box in a multi-text sub-question
So you manually have the images removed? Why not including a white "image" where you removed this image?

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
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago - 3 years 3 months ago #210367 by tpartner
Replied by tpartner on topic Hide text box in a multi-text sub-question
Maybe, as Holch suggests, insert a blank image with a specific class. Then you could use JavaScript to detect those images and hide the corresponding text input.

What LimeSurvey version are you using?

Can you attach a small sample survey (.lss file) containing only one question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 3 months ago by tpartner.
The topic has been locked.
  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210430 by Eliott13
Replied by Eliott13 on topic Hide text box in a multi-text sub-question
Thank you very much to both.

It is exactly what I am looking for.

Well, as I mentioned before, I put a blank image where I do not want the image to be shown so that I respect the position.

As Tony mentions, maybe with Java I can achieve this.

I don't really know anything about Java, and that frustrates me a bit.

I am enclosing the lss survey so you can see a bit of what I am building.

A hug to you both.

Eliott
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210432 by tpartner
Replied by tpartner on topic Hide text box in a multi-text sub-question
Assign a class "blank-spacer" to the image and place this script in the question source:
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
 
    $('#question{QID} .blank-spacer').closest('li')
      .find('input.form-control')
        .prop('disabled', true)
        .css({
          'opacity': 0,
          cursor: 'default'
        });
    });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...2616.lss
File Size:34 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.
  • Eliott13
  • Eliott13's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210433 by Eliott13
Replied by Eliott13 on topic Hide text box in a multi-text sub-question
Hi, Tony,

I offer you a huge apology.

I think I forgot for a moment to mention to you that the version I use is 2.50x

I don't know if the script doesn't work for this version as I did the steps but it doesn't execute correctly.

Regards.

Eliott
The topic has been locked.
More
3 years 3 months ago #210495 by Fran1991
Replied by Fran1991 on topic Hide text box in a multi-text sub-question
Yes it must be something with the version.

I tried it on the 3x and it worked fine, hide the text box as you mention.

Maybe Tony has a script for your version :)

Cheers
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210500 by tpartner
Replied by tpartner on topic Hide text box in a multi-text sub-question
For 2.73.0:

Code:
<script type="text/javascript" charset="utf-8">    
    $(document).on('ready pjax:scriptcomplete',function(){
 
        $('#question{QID} .blank-spacer').closest('.answer-item')
            .find('input.form-control')
                .prop('disabled', true)
                .css({
                    'opacity': 0,
                    cursor: 'default'
                });
    });
</script>

Sample survey attached:For 2.73.0:

File Attachment:

File Name: limesurvey... (2).lss
File Size:33 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.
More
3 years 3 months ago #210604 by RUB706
Replied by RUB706 on topic Hide text box in a multi-text sub-question
Hi, Tony,

You really are a master for us who do not know anything about Java.

I want to return to the subject, since I am faced with a dilemma similar to Eliott's, but in this case I want to do it with a multiple type question.

It really is the same as Elliot did but with a multiple choice question.

Is there anything that can work?

I really appreciate the help.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210608 by tpartner
Replied by tpartner on topic Hide text box in a multi-text sub-question
What LimeSurvey version are you using?

Can you attach a small sample survey (.lss file) containing only one question?

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