Set Managed Metadata field to readonly

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Adam Reyes
Posts: 35
Joined: Tue Mar 04, 2014

06 Feb 2019

Hello,

I've been trying to test the ability to make fields readonly based on a field condition. The following code seems to work just fine except when the field is a managed metadata field such as "Office":

function setBusinessCaseLockdown() {
if (fd.field('BusinessCaseLock').value() == 'Locked') {

// Getting JQuery-object of Business Case Form fields and disable them
fd.field('Title').readonly(true);
fd.field('Office').readonly(true);
fd.field('Division').readonly(true);
fd.field('Branch').readonly(true);
fd.field('ProjectGoals').readonly(true);
fd.field('Objectives').readonly(true);
fd.field('Scope').readonly(true);
fd.field('Scope1').readonly(true);
} else {
// Getting JQuery-object of the field and enable it
fd.field('Title').readonly(false);
fd.field('Office').readonly(false);
fd.field('Division').readonly(false);
fd.field('Branch').readonly(false);
fd.field('ProjectGoals').readonly(false);
fd.field('Objectives').readonly(false);
fd.field('Scope').readonly(false);
fd.field('Scope1').readonly(false);
}
}

I've tried using the following code for office like this but it doesn't seem to work:

fd.field('Office').control()._el().find('.ms-taxonomy').readonly(true);


Any suggestions?

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

08 Feb 2019

Dear Adam,

Please consider the following code:

Code: Select all

$("div[title='Office']").children().prop("contenteditable",false);
$("div[title='Office']").parent().find('img').hide();

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests