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

0 votes
Answer 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 votes
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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

259 views 2 10
Read article

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