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

More
4 years 7 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.
More
4 years 7 months ago #210301 by tpartner
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.
More
4 years 7 months ago #210359 by Eliott13
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.
More
4 years 7 months ago #210364 by holch
So you manually have the images removed? Why not including a white "image" where you removed this image?

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
More
4 years 7 months ago - 4 years 7 months ago #210367 by tpartner
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: 4 years 7 months ago by tpartner.
The topic has been locked.
More
4 years 7 months ago #210430 by Eliott13
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.
More
4 years 7 months ago #210432 by tpartner
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:33.96 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
4 years 7 months ago #210433 by Eliott13
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
4 years 7 months ago #210495 by Fran1991
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.
More
4 years 7 months ago #210500 by tpartner
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:32.77 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
4 years 7 months ago #210604 by RUB706
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.
More
4 years 7 months ago #210608 by tpartner
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.
More
4 years 7 months ago #210617 by RUB706
Hi, Tony,

Thanks for your help.

Right now I can't attach the survey, since I don't have access.

But I'll tell you that I use two versions, the 3x and the 2.73.

But right now I'm testing 2.73, which is the one with which the theme is currently

I really appreciate your great effort. ;) :)
The topic has been locked.
More
4 years 2 months ago #217496 by Vic1107
Hello everybody,

I am new to the forum and I am very beginner in this wonderful world of limesurvey

Excuse me for taking up this topic one more time.

Navigating the forum I came across this topic which is practically what I am looking for, but apparently there was no total closure of this dilemma.

As your friends mention above.

I would like to hide that select box using a blank image, I used the java code that shows @tpartner in the source code of my question but this does not hide the blank image, I want to assume that this script only works for questions of type multiple text .

Could anyone work around this point to hide blank image from multiple choice question?

I want to mention that I am also using version 2.73, (although I see that I am too outdated)

I am attaching a test survey in lss.

Thank you very much in advance to all.

Sincerely

Vic
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose