Welcome to the LimeSurvey Community Forum

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

Change error messages and pop ups for mandatory questions

  • kathryncarpenter
  • kathryncarpenter's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 7 months ago #219973 by kathryncarpenter
Hi,

I'm trying to change all error messages in my survey when someone does not answer a mandatory question. This is both the popup text box 'One or more mandatory questions have not been answered. You cannot proceed until these have been completed.' and also the red text above the mandatory question 'This question is mandatory'. 

Is there a way to do both of these?

I am running LimeSurvey 3.27.16

Many thanks,
Kathryn
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 7 months ago #219982 by tpartner
For the modal pop-up, here is a related thread - forums.limesurvey.org/forum/can-i-do-thi...e-button-text#219393

For the question mandatory text, something like this in your theme custom.js file:

Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
  // Modify mandatory text
  var mandatoryText = 'My new text!'
  $('.question-valid-container').each(function(i) {
    if($.trim($(this).text()) == 'This question is mandatory') {
      $(this).html($(this).html().replace(/This question is mandatory/, mandatoryText));
    }
  });
});

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