Recently a fellow college wanted to disable the inline notes control. Requirement was to still be able to see all the notes but not add or edit existing notes inline. With RU12/Polaris the notes control changed, therefor existing solutions for disabling the control doesn’t work. We also need to take cross browser support into consideration.
Here is a small script you can place on the form to disable the notes control. Create a new javascript web resource, add it to the form script libraries and call the “Utils.disableNotesControl” function.
var Utils = Utils || {};
Utils._disableNotesControlComponents = function (noteControlId) {
var iframe = document.getElementById(noteControlId);
var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
// we'll only disable textboxes, we'll leave the delete/add attachments etc etc enabled.
var controls = iframeDoc.getElementsByTagName("textarea");
for (var i = 0; i < controls.length; i++) {
controls[i].disabled = true;
}
}
Utils.disableNotesControl = function () {
var controlId = "notescontrol" // this is the default id of the notes control
var iframe = document.getElementById(controlId);
// onreadystatechange works with IE but not other browsers
iframe.onreadystatechange = function () {
if (iframe.readyState == "complete") { Utils._disableNotesControlComponents(controlId); }
}
// this works with chrome
iframe.onload = function () {
Utils._disableNotesControlComponents(controlId);
}
}