cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How to bind onchange to Managed Metadata field

I need to get value of Managed Metadata field onchange using custom javascript in Nintex form  in order to show/hide another field.

I have tried what is suggested on this forum  How do you validate Managed Metadata Field in a Nintex Form  but to no avail. 

I tried this simple custom validation on the control to get the value but it is not firing, no alert displaying:

function getValue(source, arguments)

{

alert(arguments.Value);

}

If anyone can suggest what i am missing here, that will be highly appreciated.

Reply
4 Replies
Workflow Hero

Re: How to bind onchange to Managed Metadata field

The tooltip in your screenshot says that the value of your managed metadata field will NOT be provided to your validation function.

This means you need to get the fields value manually inside your validation function. See ‌s answer in the post you referenced to see what can be done here.

Cheers

Philipp

Accept as Solution Reply
Workflow Hero

Re: How to bind onchange to Managed Metadata field

Thanks for the reply Philipp Lucas Lucas. I tried what Caroline Jung suggested, still not able to alert the value. Am I missing something? I guess I am struggling where to apply that code she provided, under custom javascript section or under custom validation function in the control? How to test what value is stored?

Thanks for your help!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How to bind onchange to Managed Metadata field

Best Practice would be to store the code inside a JS-File. Upload that JS-File to your SharePoint-Site (e.g. SiteAssets Library) and reference it inside your form settings. But for a small test you can also put this code inside the custom javascript section.

Inside the funtion you need to query the control from which you want to get the value from like NWF$("#"+MyFieldID).value() and you can alert this value to test it.

Accept as Solution Reply
Workflow Hero

Re: How to bind onchange to Managed Metadata field

I used Using SharePoint TaxonomyWebTaggingControl control: Access and manipulate from client side | YASP Bl... 

and added as Custom Javascript to form:

NWF.FormFiller.Events.RegisterAfterReady(function () {
    ExecuteOrDelayUntilScriptLoaded(initTaggingControl, 'ScriptForWebTaggingUI.js');
});

function initTaggingControl() {
    RTE.CanvasEvents.registerListener(RTE.CanvasEvents.editableRegionChangedEvent,
        Function.createDelegate(null, OnTaxonomyDataUpdatedDelegate));
}

function OnTaxonomyDataUpdatedDelegate() {
   //do whatever you want when value of taxonomy field changes
}
0 Kudos
Accept as Solution Reply