Caroline: Excellent information - exactly what I am looking for with a new Nintex form! I have been using Nintex forms and workflow for a couple years but still struggle to work properly with managed metadata fields effectively from forms or workflow....
I'm looking for some detail on how to "call" this method within the Nintex form in order to validate the MM field value:
- Is it configured as the Custom Validation function?
- Does this last version of your method still get inserted inside a validation function (as outlined by graham.williamson above) in order to call/activate it? Or can it be called directly after placing it alone inside the "Custom Javascript" area of the Form Settings?
Any details you can give on how to setup this method for use in a Nintex form will be greatly appreciated!!
Hi David,
I'm glad that it can help you .
To being able to use it, you need to :
Hope this helps
Caroline,
I'm a bit lost on how the function works. For each MMD field on the form do you need to add a corresponding "Client ID Javascript variable name"? How would I modify this if I only wanted to verify that a selection was made for each MMD field?
Sorry for the questions, but Managed Metadata fields seem a bit convoluted to me.
Regards,
Ken
Hi Ken,
Sorry for the delay and the confusion .
With the last javascript function that I provided in this discussion, you don't need to add each MMD client ID in a javascript variable. It's a better version than the first javascript function I shared .
You just need to reference the javascript function in the form settings and edit the control settings of each MMD field to set "Use custom validation" to "Yes" and "Custom validation function" with "managedMetadataValidationFunction" and that's all .
Tell me if it's not clear
Ah...now I get it! Thank you for clearing that up for me.
Ken
Perfect ! I'm glad I could help
Caroline,
I've finally gotten around to working with your validation code. It works...somewhat. For some reason it produces a validation error regardless if the field is populated or not. If I enter a new value and save/submit, the error persists.
We are using a document library with checkout/check-in and versioning enabled (if it makes any difference).
Any ideas why it would behave in this manner?
Ken
Here is what I have in the Custom Javascript:
Since we only needed to test for an empty value, we alter the script (see below) and now it works as needed.
function managedMetadataValidationFunction(source, arguments) {
arguments.IsValid = true;
if (NWF$(source).parent().find("span.valid-text").length != 1) {
arguments.IsValid = false;
}
};
Thank you!
Hi Ken,
Yes that's correct. The previous script you posted was to check if the managed metadata field had a term which label is "Test term" and not only if a term was populated or not.
Thanks for your feeback