Domanda

How could I set/change the value of an enterprise keyword field in a form using javascript?

È stato utile?

Soluzione

Well, The Enterprise Keyword works pretty similar to the Managed Metadata Field... So i was able to set the values as i did with the Managed Metadata Field (using javascript):

    var myMetadataField = $('div[Title="' + MetadataField + '"]').find('div[role="textbox"]');
    myMetadataField.text("");

    var myMetadataField = $('div[Title="' + MetadataField + '"]').find('div[role="textbox"]');
    var myContainer = myMetadataField.parent().parent().parent();
    var divElement = myContainer.get(0);
    myMetadataField.text(listData.join(";"));

    var controlObject = new Microsoft.SharePoint.Taxonomy.ControlObject(divElement);
    controlObject.validateAll();

Where MetadataField is the title of your managed Metadata field

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top