Enhanced Rich Text Field displays error message twice!

Discussions about Forms Designer for SharePoint 2010.
Locked
Merley72
Posts: 17
Joined: Tue Sep 30, 2014

14 Oct 2015

Hi,

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

15 Oct 2015

Hi!

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:

Code: Select all

fd.onsubmit(function(){
        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 ... a6c6e8f984.

Merley72
Posts: 17
Joined: Tue Sep 30, 2014

15 Oct 2015

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.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests