Rich Text Field ReadOnly Internet Explorer
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.
-
adaventoMemberMember for: 8 years 6 months 7 days
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 KozlovAdminMember for: 9 years 8 months 16 days
[#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);
-
zahappyMemberMember for: 2 years 2 months 7 days
-
peter0900MemberMember for: 6 months 29 days
No user input or updates are permitted when the RichTextBox is set to read-only, but automated changes are still possible. The user can, nonetheless, choose text.