Welcome to the LimeSurvey Community Forum

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

Terms of Use reveals on upon check-box entry

  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago - 4 years 4 months ago #191771 by bulgin
Hello.

The standard Limesurvey install has a very nice Welcome message which is coded so that if someone ticks a single checkbox, a list can show of the various agreed-to terms: Data retention policy, Terms of Use and Privacy Policy (if that's what the user wants and has coded).

My particular system can't use the hard-coded Welcome message with it's ability to reveal the Policy on checkbox tick because of other hard-coded data existing before and after the default Welcome message.

I know this can be duplicated as a simple question with sub-question, but I'm stuck on exactly how.

I've created the first question in this group with only the message "To continue, please Agree to our Terms of Use".

Now, I'm pretty sure I have to create a sub-question that is revealed when the user clicks the single tick-box in the first question.

Can someone offer advise on how this is done? I have also attached two screenshots of my current Welcome message which I cannot use but would like to reproduce with whatever method can be used to do so.

Thanks.
Last edit: 4 years 4 months ago by bulgin.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #191789 by tpartner
Replied by tpartner on topic Terms of Use reveals on upon check-box entry
I don't understand the need to hide the terms.

I would...

- Place all of the terms in the question text of a multiple-choice question that has one sub-question - "I agree with the terms".

- Place this script in the source of that question. It will disable the "Next" button unless the "agree" checkbox is selected.

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Initially disable the next button
    $('#ls-button-submit').prop('disabled', true);
 
    // Listener on the checkbox
    $('#question{QID} .answer-item input:checkbox:eq(0)').on('change', function(e) {
      if($(this).is(':checked')) {
        $('#ls-button-submit').prop('disabled', false);
      }
      else {
        $('#ls-button-submit').prop('disabled', true);
      }
    });
    });
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...2-05.lss
File Size:17 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.

Lime-years ahead

Online-surveys for every purse and purpose