Enhanced Rich Text Field displays error message twice!


Posted by Merley72 - Oct 14 ’15 at 11:20


With an Enhanced RTF, if you set that to be mandatory via the Column setting in the SharePoint List and then create a New document the warning message of 'You must specify a value.....' appears twice (one above the other) on the form.  RTFs which are Plain text or simple Rich text display the message only once.  To me this is no desperately bad thing, however a customer we are working with is making a bit of an issue about it to us.

Have others noticed this and is there a reason?

There is also a generic SharePoint 'feature' with Enhanced RTFs that then caught me out as I was considering my options.  In order to check things thoroughly, I went and created a test List and added column types of each of the RTF variants - Plain, Rich Text, Enhanced Rich text and messed about with that creating new and then editing documents.  What I found was that if you have an Enhanced RTF column that is mandatory, create a form with a value in that and save it, then go and edit that form and completely clear the field, you can still Save the document!  To my mind surely this is a FAIL on the part of Microsoft?  Once you re-edit the document, there is always some form of spaces and returns in the 'empty' field and it can never be empty again - thus never properly checked.   Again - have others come across this and is it a known 'foible' ?

Thanks to anyone who can add info to these questions.

  • rostislav
    Member for: 5 years 5 months 15 days
    #1 by rostislav Oct 15 ’15 at 06:17


    They are both known issues.

    Regrding your second issue, you can use a custom check for this. Paste the following code into the JS editor of Forms Designer:

            if (fd.field('EnhancedRichTextBoxInternalName').control()._el().find('div.ms-rtestate-write').text().length  == 0 ) {
                    alert('enter something in the box');
                    return false;
            return true;

    If you utilize this validation method, then that solves your first issue too. Which is a known browser-specific MS bug, see http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/719e1521-f4ea-4e2a-aa69-17a6c6e8f984.

  • Merley72
    Member for: 6 years 19 days
    #2 by Merley72 Oct 15 ’15 at 08:23

    Hi Rotislav,

    After lodging the 'problem' I wnet and investigated further and came across the MSDN link you refer to.  I must admit that this is bit of a fail on the part of MS I think - poor testing perhaps?

    The options to get over this will be to use a secondary check for field values or more likely to change the field type to just Rich text as it isn't essential that this is an Enhanced text field.

    As for the checking, I created a validation based on the number of characters in the field as an alternative, howe that is still a poor second approach to having a clean identification by generic SharePoint code.  A check in the onsubmit works better that my method thouigh so thanks very much for sharing the method.

    Regards  Alan C.

Displaying 1 to 2 of 2 messages