Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory labels in Confluence

Chris Wood
Contributor
December 3, 2013

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
Chris Wood
Contributor
December 10, 2013

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;
}


Kai Ehlig
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 19, 2017

This is what I am looking for

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

Like PorschefanRoel likes this
Colm Maguire
Contributor
January 26, 2023

the theme javascript file apparently

0 votes
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 4, 2013

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

Chris Wood
Contributor
December 9, 2013

Thanks Davin.

Anybody have code samples for this?

Scott Oliver November 12, 2014

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

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 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
TAGS
AUG Leaders

Atlassian Community Events