Hide/Reveal series of Managed Metadata columns
Posted: 30 Oct 2017
Hello,
I've tried figuring this out on my own without result so far. What I'd like to do is this. I have several columns where a user could enter information about the languages they know. The languages they choose come from a managed metadata source. For various reasons, each cell must be limited to one entry. This is why I have several of these fields in the SharePoint list. So I have fields called Langauge01, Language02, Language03, and so on to 08.
I don't want the form to fill up with blank options most users don't use, though. I want to create a kind of hide/reveal action on the form.
I've been trying to figure out the correct JavaScript code so that if Language01 is blank, the Language02 field is hidden. Then when someone makes a selection for Language01, the Language02 field appears. Language03 is hidden until Language 02 is no longer blank. And so on.
I can't get even one iteration of this to work, though. I think I'm missing some detail about coding for the managed metadata field type. Here's what I have:
function showfield_hide01() {
var Language01 = $.trim(fd.field('Language01').control()._el().find('.ms-taxonomy .valid-text').length == 0));
if (Language01 == "") {
$('.field_hide01').hide();
}
}
Any suggestions please? Thanks.
I've tried figuring this out on my own without result so far. What I'd like to do is this. I have several columns where a user could enter information about the languages they know. The languages they choose come from a managed metadata source. For various reasons, each cell must be limited to one entry. This is why I have several of these fields in the SharePoint list. So I have fields called Langauge01, Language02, Language03, and so on to 08.
I don't want the form to fill up with blank options most users don't use, though. I want to create a kind of hide/reveal action on the form.
I've been trying to figure out the correct JavaScript code so that if Language01 is blank, the Language02 field is hidden. Then when someone makes a selection for Language01, the Language02 field appears. Language03 is hidden until Language 02 is no longer blank. And so on.
I can't get even one iteration of this to work, though. I think I'm missing some detail about coding for the managed metadata field type. Here's what I have:
function showfield_hide01() {
var Language01 = $.trim(fd.field('Language01').control()._el().find('.ms-taxonomy .valid-text').length == 0));
if (Language01 == "") {
$('.field_hide01').hide();
}
}
Any suggestions please? Thanks.