We have taxanomy – TaxonomyWebTaggingControl placed on a admin control panel. We need to assign/set value(value is lookup value:keyword) to the control by using JavaScript.
Code is already written, but still it’s not displaying or setting up the values for TaxonomyWebTaggingControl.
<Taxonomy:TaxonomyWebTaggingControl ID="TaxonomyKeywords" runat="server" IsDisplayPickerButton="False" WidthCss="taxonomyWidth" IsIgnoreFormatting="True" IsMulti="true">
</Taxonomy:TaxonomyWebTaggingControl>
Below code is piece of code where the value is getting assigned –
document.getElementById('<%=TaxonomyKeywords.ClientID %>').value = Keywords[1]
We have tried by using following ways
1.Observations 1: Is Lookup value:keyword itself is coming?
we have take the simple textbox, and do the same thing – Values are getting displayed there. SO,DEFINITELY values are getting retrieved from the SharePoint list.
So..this is how we declared it….
<input id="txtKeyWord"....
In this Case, keywords are displayed in text box, but as we are displaying it lookup value and we need to store as a termset value we have to use TaxonomyWebTaggingControl control.
2.Observations 2 : We tried with another approach
function setTaxonomyControlObjectValue(webTaggingId, termValue) {
var webTaggingCtl = $get(webTaggingId);
var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject(webTaggingCtl);
taxCtlObj.enableControl(true);
taxCtlObj.setRawText(termValue);
taxCtlObj.retrieveTerms();
}
function initCountryTaggingControl(){
var countriesControlId = "ctl00_PlaceHolderMain_ctl03";
var continentTermValue = "Africa|43f3b1e7-e40c-45d2-a613-88643668d373";
setTaxonomyControlObjectValue(countriesControlId, continentTermValue);
}
ExecuteOrDelayUntilScriptLoaded(initCountryTaggingControl, 'ScriptForWebTaggingUI.js');
Still it’s not working…
Help is requested