Welcome to the LimeSurvey Community Forum

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

Soft Warning Message

  • boshra.m
  • boshra.m's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 9 months ago #236383 by boshra.m
Soft Warning Message was created by boshra.m
Please help us help you and fill where relevant: LimeSurvey Cloud Version 5.4.12
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: Fruity
==================
Hello!

I have used the following to change the warning message text in my questions: 
<script type="text/javascript" data-author="Tony Partner">
    $(document).on('ready pjax:scriptcomplete',function(){
 
        // Define some text strings
        var originalModalText = "One or more mandatory questions have not been answered. If possible, please complete them before continuing to the next page.";
        var newModalText = "It looks like you have missed some questions. Do you want to answer them or go to the next page?";
 
        // Modify the modal text
        var modalBody = $('.modal-body p').filter(function() {
            return $.trim($(this).text()) == originalModalText;
        });
        if(modalBody.length > 0) {
            modalBody.text(newModalText);
        }
    });
</script>

And whilst this works for the majority of my questions (and therefore question groups), for three of my question groups, it is not working. I hav attached a sample of the survey below. I believe it's to do with the array questions in these questions. Not sure why because for the other question groups in my survey where I have both array and multiple choice (List radio) it works fine.

But I might be missing something!

Thank you!
 

File Attachment:

File Name: softwarnin...6925.lss
File Size:219 KB

 
  • Please Log in to join the conversation.

    • tpartner
    • tpartner's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 year 9 months ago #236403 by tpartner
    Replied by tpartner on topic Soft Warning Message
    The problem is that the original warning text in those groups is different from what you defined in the script.

     

    Use this script:
     
     
    Code:
    <script type="text/javascript" data-author="Tony Partner">
      $(document).on('ready pjax:scriptcomplete',function(){
     
        // Define some text strings
        var originalModalText = "One or more Required Questions have not been answered. You cannot proceed until these have been completed.";
        var newModalText = "It looks like you have missed some questions. Do you want to answer them or go to the next page?";
     
        // Modify the modal text
        var modalBody = $('.modal-body p').filter(function() {
          return $.trim($(this).text()) == originalModalText;
        });
        if(modalBody.length > 0) {
          modalBody.text(newModalText);
        }
      });
    </script>

    Sample survey attached: 

    File Attachment:

    File Name: limesurvey...6925.lss
    File Size:216 KB

    Cheers,
    Tony Partner

    Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
  • Please Log in to join the conversation.

    • boshra.m
    • boshra.m's Avatar Topic Author
    • Offline
    • Premium Member
    • Premium Member
    More
    1 year 9 months ago #236455 by boshra.m
    Replied by boshra.m on topic Soft Warning Message
    Hello,

    Thank you very much for your reply. Your response helped me solve two of the pages. Interestingly enough the second page (starting with question 3-1) of the survey you attached back still shows as the original warning text. 

    Is that just on my end?

    Thank you!

     

     
  • Please Log in to join the conversation.

    • tpartner
    • tpartner's Avatar
    • Offline
    • LimeSurvey Community Team
    • LimeSurvey Community Team
    More
    1 year 9 months ago #236466 by tpartner
    Replied by tpartner on topic Soft Warning Message
    Look at the text in the warning and adjust the script accordingly.

    Cheers,
    Tony Partner

    Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

    Please Log in to join the conversation.

    Moderators: tpartnerholch

    Lime-years ahead

    Online-surveys for every purse and purpose