Welcome to the LimeSurvey Community Forum

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

Array with some cells disabled

More
9 years 4 months ago - 9 years 4 months ago #134433 by tammo
I would like to use an multi-flex-text array with numbers only and disable certain cells.

My Javascript/JQuery capacities are too low, so I would kindly ask one of the gurus to guide me in the right direction.

I hope the attached image tells all. Using 2.50 built 160411



Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Last edit: 9 years 4 months ago by tammo. Reason: Earlier image not applicable
The topic has been locked.
More
9 years 4 months ago #134439 by tpartner
Hi Tammo, do you want the inputs just disabled (greyed-out) or completely removed?

Can you attach a sample survey containing that 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
9 years 4 months ago #134443 by tammo
Hi tpartner,

see attachment.

There is an additional wish too: I would like the total of the third question to equal the answer of the second question. Only after that the third question has been answered right.

Example: second question = 56.8

Thanks in advance, this will be my (well, actually your) first Javascript in version 2.5!

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #134444 by tammo
@tpartner: Preferably greyed out, but I would also like to know how to remove them completely...


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #134446 by jelo
Replied by jelo on topic Array with some cells disabled

tammo wrote: see attachment.

Do you mean the png image? Or did you attached a sample survey as tpartner asked for?
Cannot see that sample survey anywhere?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: tammo
The topic has been locked.
More
9 years 4 months ago #134448 by tammo
Attachment


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #134454 by DenisChenu
Quick test using jquery and EM
In question text
Code:
<script>
$(function() {
    $("answer{SQG}SQ01_SQ01").prop('disabled',true);
});
</script>
Update SQ01 and SQ01 to needed line and column (i never remind if X is first and Y seconc, i think it answer{SQG}SY01_SX01 but unsure.

I don't really understand your second need : but i think it can be done with EM and www.limesurvey.org/manual/Question_type_...28em_validation_q.29

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: tammo
The topic has been locked.
More
9 years 4 months ago #134455 by tpartner

@tpartner: Preferably greyed out, but I would also like to know how to remove them completely

Note that disabling will not work with a mandatory question.

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: tammo
The topic has been locked.
More
9 years 4 months ago #134462 by tpartner
To avoid confusion, I would change the sub-question codes to reflect the scale. So, something like X1-X15 and Y1-Y4.

Then Denis' script could be:
Code:
<script>
  $(function() {
    $("#answer{SGQ}Y1_X1").prop('disabled',true);
  });
</script>

And, to address your second requirement, the question validation equation could be:
Code:
sum(that.FTE1.sq_Y2) == sum(that.FTE1.sq_Y3)

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
9 years 4 months ago #134464 by tammo
I am standing on the shoulders of giants
en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants

;)


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #135353 by tammo
This works very well for an array with texts (where only numbers are allowed).

I now also have another array: array with numbers, checkbox layout. Here the trick does not work.

Anyone knows how to get this working?


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #135358 by tpartner
Try this:

Code:
<script>
  $(function() {
    $("#cbox_{SGQ}Y1_XA").prop('disabled',true);
  });
</script>


File Attachment:

File Name: limesurvey...4_TP.lss
File Size:44.22 KB

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: tammo
The topic has been locked.
More
9 years 4 months ago #135362 by tammo
Thanks, this works, but it does not show it.

Is there also a way of not showing the checkbox, or should I better do that with css?


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
More
9 years 4 months ago #135383 by tpartner
I do see them as greyed-out - see screenshot below. If you want to increase the effect, try adding something like this to the CSS:

Code:
.checkbox input[type="checkbox"]:disabled + label::before, 
.checkbox input[type="radio"]:disabled + label::before {
    opacity: 0.5;
}


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose