Mandatory labels in Confluence

Hi,

Is there an option to ensure a label must be entered into the editor with confluence 5.2?

I have read other articles and there does not appear to be any concrete solution to this.

We can instruct users to fill out the label field but it would be nice if they could not save until atleast 1 is entered.

Thank you!

2 answers

1 accepted

One of our developers put the following into the theme javascript file:

Hope this helps someone else.

$(document).on("click", "#rte-button-publish", function(e) {
            var labelbutton = $("#rte-button-labels");
            if($(labelbutton).length > 0)
            {
                if($(labelbutton).find(".trigger-text").text() == "Labels")
                {
                    e.preventDefault();
                    e.stopPropagation();
                    alert("Page requires at least one or more labels");
                }
            }
        });

/* CSS to not let last label be removed */
.aui-label.aui-label-closeable:last-child:first-child {
    padding-right: 5px;
    position: relative;
}

.aui-label.aui-label-closeable:last-child:first-child .aui-label-split-close {
    display: none;
}


This is what I am looking for

It would be great to know which file I need to edit 

0 vote
Davin Studer Community Champion Dec 04, 2013

Nope. No option for that. You could write a plugin for it, or maybe write a Speakeasy extension for it.

Thanks Davin.

Anybody have code samples for this?

Hi. Could the above css be extended to remove the 'x' for labels containing a certain value? Thanks.

Davin Studer Community Champion Nov 12, 2014

Not with just CSS no. You would need to use JavaScript for that. With CSS 4 you could do it, but nothing supports CSS 4 yet.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

872 views 21 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you