Rich Text Field ReadOnly Internet Explorer

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
adavento
Posts: 2
Joined: Mon Dec 29, 2014

29 Dec 2014

Hello,


I have been working on a custom form, using Froms Designer, and have encountered a problem.


The form is representing a non-conformance and where you have different tabs for different phases, and when you go from one phase to the next, the previous tab (phase) and its fields should be ReadOnly. The fd.field(‘InternalNameCreatedByFD’).readonly(true) does not work, and I have used javascript and JQuery instead to make the fields ReadOnly. That works great for all web-browsers except Internet Explorer. The fields are rich text, and they get editable. It seems that there is some sort of plug-in (rich text editing), or something else that overrides the ReadOnly.

I have tried all the readonly and disable methods with Javascript and JQuery, but it gets overrrided in Internet Explorer.

Have any encountered this problem before?


Any help is appreciated.

adavento
Posts: 2
Joined: Mon Dec 29, 2014

30 Dec 2014

Here is the solution.

Insert the code into JS-editor:

if (typeof(RTE_OnFocus) == 'function') {

var RTE_OnFocusOrig = RTE_OnFocus;

RTE_OnFocus = function(strBaseElementID) {

if (!$('#' + strBaseElementID).data('readonly')) {

RTE_OnFocusOrig(strBaseElementID);

} else {

(RTE_GetEditorDocument(strBaseElementID)).body.contentEditable = false;

}

}

}

Enable/Disable Rich Text Fields with:

// Disable

fd.field('Text').control()._el().find('textarea').data('readonly', true);

// Enable

fd.field('Text').control()._el().find('textarea').data('readonly', false);


All thanks to Dmitry Kozlov (Forms Designer Team).

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

30 Dec 2014

Thanks for posting it here! Just wanted to add formatted code:

Code: Select all

if (typeof(RTE_OnFocus) == 'function') {
     var RTE_OnFocusOrig = RTE_OnFocus;
     RTE_OnFocus = function(strBaseElementID) {
           if (!$('#' + strBaseElementID).data('readonly')) {
                RTE_OnFocusOrig(strBaseElementID);
           } else {
                (RTE_GetEditorDocument(strBaseElementID)).body.contentEditable = false;
           }
     }
}

// Disable
fd.field('Text').control()._el().find('textarea').data('readonly', true);

// Enable
fd.field('Text').control()._el().find('textarea').data('readonly', false);

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests