Skip to main content

Hi All - Is there a way to create a list of tags and require users to select at least one when posting? I’m basically trying to get members to say what product they use when they post … 

Hey!

No, there is no feature which will let you force users to add tags.

Usually your categorization is already defining which product a user is talking about. However that must not always be the case...

A tip that I can give you is to adjust the placeholder text in the editor, e.g. “please name the product your question is about” or something like that. All details about it can be found here, but let me know if you have additional questions or issues setting this up.

Also, if you would like a feature as you have described, feel free to submit it as an idea! :)


Orrrr you can vote for this, @Kgastaldo : https://community.insided.com/ideas/102

Your use-case will fit there, too :) 

 

Cheers,

Ditte


Hi. Is this still the case? Hoping it’s possible to make Tags a required field instead of optional one when posting.


There is a “hack” for this. I tested it and decided we probably didn’t need to use immediately. But I found the code. This create creates a MutationObserver to monitor changes on the page. It goes in the “After <Body>” section. When the page is loaded an initial check is carried to see if there are any tags. If not, then the button is rendered useless. It is only “switched on” when a tag is entered.

Give it a try. It is not perfect, but is should enable this functionality….

 

<style>
.create-disabled {
pointer-events: none;
opacity: 0.5;
cursor: not-allowed;
}
</style>

<script>
document.addEventListener("DOMContentLoaded", function() {
const wrapper = document.querySelector('.public-tag-wrapper');
const button = document.getElementById('topic_save');

// Update the create button's state
function updateButtonState() {
const tags = wrapper.querySelectorAll('.public-tag_selected-tag-name');
if (tags.length === 0) {
button.classList.add('create-disabled');
button.disabled = true;
} else {
button.classList.remove('create-disabled');
button.disabled = false;
}
}

// MutationObserver - watching for changes in the page
const observer = new MutationObserver((mutations) => {
updateButtonState();
});

// Look for all changes:
const config = { childList: true, subtree: true };

// Start observing
observer.observe(wrapper, config);

// Call on page load
updateButtonState();
});

</script>

 


@rhall Thank you so much for sharing, I definitely want to look into this. I would love to ask you another question, if you’re willing - strategically, why did you choose to not utilize this? Was that decision related to the technical aspect of this workaround, or did you conclude that a different user experience was better for your community? 


Hi @mbuuck1,

Make sure you play around with this in your sandbox before putting it live. There are other bits you may want to add. For example, a message to indicate that tags are required, etc.

One of the reasons we did not implement this is that it didn’t fulfil our requirement on its own. What we wanted was to have “types” of tag. Without going into too much detail, it was an idea of having some tags as required (or one or more of the type of tag to be selected) and others to be adhoc. To implement this it would have added a whole load of extra code to this. Since our Community is new, we decided to learn from our audience before going to extreme levels of customisation. 

But if you want to force your users to select at least one tag, this will prevent them from saving a post without selecting one. But as I said, you will want to alert them to this.


@rhall Thank you so much! That makes a lot of sense to me - I really appreciate your time and expertise!


@mbuuck1 I am actually a newbie to Gainsight. I just like to get into the weeds to see what can be done ;-)


Reply