Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've created a survey with rating questions and branch logic and most are required fields. Any suggestions/ideas on how to use Javascript/JQuery to change the OOTB required field user message "You must specify a value for this required field" ?

Thanks in advance

share|improve this question
    
can you share some bits of the html source around the field validator? –  Tiago Duarte Jul 31 at 21:15

2 Answers 2

this will be attached specifically to surveys and you can tweak both types of messages

<script type="text/javascript">
$(document).ready(function () {

        //override: "You must specify a value for this required field."

        //per-field validator
        $('.ms-formbodysurvey .ms-formvalidation > span[role="alert"]').text("Please specify a value for this field.");

        //summary validator
        $('.ms-formbodysurvey span.ms-formvalidation[role="alert"]').text("Please make sure all required fields are properly filled.");

});
</script>
share|improve this answer
    
Thanks, that helpered alot. –  rhonda Aug 25 at 15:20

You can use this code. You should add this to both NewForm.aspx and EditForm.aspx.

<script type="text/javascript">
$(document).ready(function(){

var alertSpan= $('span[role="alert"]');
alertSpan.text('My Custom Alert!');

});
</script>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.