Rich Text Field ReadOnly Internet Explorer

rss

Posted by adavento - Dec 29 ’14 at 05:13

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
    Member
    Member for: 5 years 14 days
    #1 by adavento Dec 30 ’14 at 03:13

    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).

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 26 days
    #2 by Dmitry Kozlov Dec 30 ’14 at 07:52

    [#1]: Thanks for posting it here! Just wanted to add formatted code:

    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);
    
    
Displaying 1 to 2 of 2 messages