- Posts: 102
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Soft Warning Message
- boshra.m
- Topic Author
- Offline
- Premium Member
Less
More
1 year 3 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!
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!
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
1 year 3 months ago #236403
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
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:
Sample survey attached:
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:
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 102
- Thank you received: 2
1 year 3 months ago #236455
by boshra.m
Replied by boshra.m on topic Soft Warning Message
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
1 year 3 months ago #236466
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
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.