Page 1 of 1

Managed Metadata column required

Posted: 10 Jun 2020
by asharma190
I am having trouble setting a managed metadata column (name: key industry) required on submit --- I am using the below (which has worked before in other field types). Just need a basic on submit check --- cannot set it on the list as required due to other technical reasons. Any help would be appreciated. Thanks!

fd.onsubmit(function () {
if fd.field('KeyIndustry').value() == '') {
alert('Please, fill in key industry');
return false;
}
}

Re: Managed Metadata column required

Posted: 11 Jun 2020
by mnikitina
Hello asharma190,

There are typos in your code, please see updated code:

Code: Select all

fd.onsubmit(function () {
	if (fd.field('KeyIndustry').value() == '') {
		alert('Please, fill in key industry');
		return false;
	}
	    return true;
});
Also, if 'KeyIndustry' is Managed Metadata field, use this code to check if it has value:

Code: Select all

fd.field('FieldName').control()._el().find('.ms-taxonomy .valid-text').length == 0