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

How do you validate Managed Metadata Field in a Nintex Form

I have several (many) Nintex Forms with Managed Metadata Fields and I have been unsuccessful validating the fields. Problem is if left alone users can type whatever they want in the field which is not acceptable

The rules are working otherwise so far but not for Managed Metadata field, how do you validate users select from the connected field and not just type in free form text.

I have tried using the Connected field ( from the List Colum. )  and check to make sure it is not empty IsNullor Empty (Item Property Name) and that does not work.   I have also tried not(Item Property Name) - that does not work.

My question is what works?  does anyone know I need an answer ASAP.

Thanks

Carol

Labels: (3)
Reply
18 Replies
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

I don't use Nintex Forms but if you can use code to do it, I found this for you:

http://prashobjp.wordpress.com/2012/01/06/validate-managed-meta-data-fields-in-item-adding-event-rec...

Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Thank you Burkslm -  I appreciate your response, however we are now using Rules Validation a built in function in Nintex forms.  I had JavaScript codes which works originally but had to remove the JavaScript.   I will look at the information sent, but Nintex Rules validation is what I am trying to accomplish.  The JavaScript that worked previously will not work now.

Thanks

Carol

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Yeah there are rules in InfoPath as well.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Would RegEx be useful?

Lisa

Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Tried   - not working for me.

Accept as Solution Reply
Not applicable

Re: How do you validate Managed Metadata Field in a Nintex Form

Hi,

I see that the latest release of Nintex Forms (2.5.0.0) that was release last week has a fix in it for the custom validation of Managed Metadata fields (see Nintex Forms 2013 - Release Notes )

I have tried using a javascript validation function

function ValidateField(source, arguments)

{

alert(arguments.Value);

}

This is firing ok but the value shown in the alert is always empty.

Does anyone know how I should be accessing the value of the metadata field so that I can test it's value.

Thanks

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Hi Graham,

Sorry, my answer comes a bit late...

Getting the value of a managed metadata field via the arguments of the javascript validation function is currently not supported.

To get the value of a managed metadata field, you can store its client id in a javascript variable (via the managed metadata control settings, "Advanced" section then "Client ID Javascript variable name" field), for example, "myManagedMetadataClientID" and then run the following javascript inside the javascript validation function :

function managedMetadataValidationFunction(source,arguments) {

     arguments.IsValid = true;

     // To check the number of terms populated

     if(NWF$("#" + myManagedMetadataClientID).find("span.valid-text").length != 1) {

          arguments.IsValid = false;

     }

     // To check the name of the terms populated

     var testTermPopulated = false;

     // For each term populated in the managed metadata field

     NWF$("#" + myManagedMetadataClientID).find("span.valid-text").each(function() {

          if(NWF$(this).text() == "Test term") {

               testTermPopulated = true;

          }

     });

     // If a specific term is not populated

     if(!testTermPopulated) {

          arguments.IsValid = false;

     }

}

Hope this helps

Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

How do you implement this solution for multiple fields? So far when I have tried it causes all validation on the form to break.

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How do you validate Managed Metadata Field in a Nintex Form

Can you try with the following function ?

function managedMetadataValidationFunction(source,arguments) {

     arguments.IsValid = true;

     // To check the number of terms populated

     if(NWF$(source).parent().find("span.valid-text").length != 1) {

          arguments.IsValid = false;

     }

     // To check the name of the terms populated

     var testTermPopulated = false;

     // For each term populated in the managed metadata field

     NWF$(source).parent().find("span.valid-text").each(function() {

          if(NWF$(this).text() == "Test term") {

               testTermPopulated = true;

          }

     });

     // If a specific term is not populated

     if(!testTermPopulated) {

          arguments.IsValid = false;

     }

}

Accept as Solution Reply