2

I have two required columns in a custom list. When adding an item using OOTB new form, the required field validator shows same error message

You can't leave this blank.

For both required columns. Does anybody know what is the best way to show different messages for each of them?

2

Instead of Required Field. Just add a validation based on following formula.

=IF(ISBLANK([Field]),FALSE,TRUE)

Now use Validation Error Message for custom message.

1

You can use Strings.STS to override message. Just add this code to your page or master page if you want to apply all your site.

<script type="text/javascript">
        $(document).ready(function () {
            try {
                if (Strings.STS.L_SPClientRequiredValidatorError != null) {
                    Strings.STS.L_SPClientRequiredValidatorError = "What ever you want!";
                }
            }
            catch (exception) { }
        });
    </script>

For more information:

SharePoint 2010 use message:

"You must specify a value for this required field." It showed after validating from the server.

SharePoint 2013 shows a message:

"You can't leave this blank."

after validating from the client. But, if you use SharePoint webpart and SharePoint control, it still shows a message same as SharePoint 2010. It makes it inconsistent from your site.

1
  • OP wants to show different messages for each of the fields, not change it everywhere – Robert Lindgren Jun 1 '17 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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