1

How can i get picked/selected value from Taxonomy Picker "input". I have have implemented my Taxonomy field like showed in this article

And its working fine, the only thing i cant figure out is how to get the selected / picked taxonomy value from the input field. I need that value to further use it in my REST query to save in a list.

Iam working on a SharePoint Add-in app-part, using AngularJS, bootstrap, JSOM. Any help will be appriciated....

2 Answers 2

0

You should be able to get it using something like this:

function getTaxonomyControlObjectValue() {
     var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject($("#" + scope.contentControlId).get(0));
     var termValue = taxCtlObj.getRawText();
     return termValue;
}

You mentioned you were using AngularJS so that is why the scope object is up there. For anyone else, just replace the scope.contentControlId with your actual ID.

0

Oki, i can get or se the value:

var taxPickerIndex = $("#taxPickerOpenSingle").get(0);

[{"Id":"e0a1f57a-6746-4ecc-b119-47f2ff80a1ea","Name":"L3-2 Forbedringsprosess","PathOfTerm":"L3 Lede og forbedre;L3-2 Forbedringsprosess","Children":[],"Level":1,"RawTerm":null}]

but when it comes to line with code:

var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject($("#" + scope.contentControlId).get(0));

I get an error :

TypeError: Cannot read property 'ControlObject' of undefined

Blockquote

iam running my code in a SharePoint online, ClientWebPart/App-Part as they call it now. Using AngularJS/Bootstrap jQuery, JSOM, and JAvascript....

1
  • i was not ref to script correct way: need to call SP.SOD.executeFunc('ScriptForWebTaggingUI.js', false, test); and put this line in default.aspx : <SharePoint:ScriptLink name="scriptforwebtaggingui.js" runat="server" OnDemand="true" LoadAfterUI="true" Localizable="false" /> Commented Jul 2, 2016 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.