Is it possible to require users to fill in "What did you change?"?

When changing a page in Confluence, there is a text box at the bottom for "What did you change?". Is it possible to make this a required field, so users have to enter a change message? In my previous experience with Wikis, this seems to help a lot when you're looking at list of recent changes or trying to find something in the history of a page, because at the least it provides a hint to relevant/irrelevant changes.

If you don't require users to fill it in, it's easy to forget or simply skip. Making it a required field is about the only way to make it work.

----

Update: I ended up doing what Matthew Horn suggested.

To add this, first create a .js file hosted on a webserver somewhere, accessible to anyone accessing your Confluence install. If you're running a proxy in front of the Tomcat confluence server, that is a good place, in for example, a /custom directory.

Contents of this file:

jQuery(function(){       
        var saveEnabledTitle = 'Save your page ( Type \'Ctrl+S\' )'
        var previewEnabledTitle = 'Preview ( Type \'Ctrl+Shift+E\' )'
        var saveDisabledTitle = 'Please enter a change comment before saving';
        var previewDisabledTitle = 'Please enter a change comment before previewing'; // confluence UI limitation

        var saveButtonCheck = function() {
                var commentField = jQuery('#rte-savebar #versionComment');
                if (commentField.length == 0 || !$(commentField).is(':visible')) return;

                if (commentField.val().length > 0) {
                        jQuery('#rte-savebar #rte-button-publish')
                          .enable()
                          .attr('title', saveEnabledTitle);
                        jQuery('#rte-savebar #rte-button-preview')
                          .enable()
                          .attr('title', previewEnabledTitle);
                } else {
                        jQuery('#rte-savebar #rte-button-publish')
                          .disable()
                          .attr('title', saveDisabledTitle);
                        // note: have to disable preview too, since it doesn't work if the publish button is disabled. Probably a workaround but pretty complex.
                        jQuery('#rte-savebar #rte-button-preview')
                          .disable()
                          .attr('title', previewDisabledTitle);
                }
        }
        saveButtonCheck();
        jQuery('#rte-savebar #versionComment').keyup(saveButtonCheck);
        $('.aui-buttons.toolbar-group-preview, .save-button-container').click(function() { $('#versionComment').focus(); });

});

To add this to your Confluence, under administration, go to Custom HTML and add to "At the end of BODY":

<script type="text/javascript" src="https://hostname/path/to/file.js"></script>

This is a total hack, but it seems to work so far. Note that if you disable the Save button, the Preview function stops working, which is why I also disabled that button (my preference would be to only require the comment to Save, but it's not a big deal).

Warning: after using this for a year, many users still type useless comments like "update" or "edited" or even just a period. I think it probably will take until they have to go back and wade through a couple dozen changes to find a particular edit themselves before see the value. What's the saying.. you can lead a horse to water...

6 answers

1 accepted

What I would do is not try to add any back-end logic (in other words, change the form processing), but rather add some JavaScript. I would disable the Preview and Save buttons by default, and only enabled them when the length of the versionComment field is greater than 0.

Hi Greg, you may be able to help me out.

This is basically the kind of functionality I'm looking for, but I just need to know, where did you put this bit of javascript in order for it to effect the confluence page editor?

Thanks in advance

Matt

Thank you Greg for this piece of code.

Since I am rather new to programming with Confluence, could you please tell me where to put this code?

TIA

Kai

Edited to include instructions

Edited to include instructions

Thank you Greg for this code.

Using Custom HTML and adding at the end of body, will work only for that page...

My question:

Is it possible run this code in all page of confluence as default? like a event...

Regards,

Caio.

 

 

 

 

The way I described to add it adds for all pages (Administration > Custom HTML). I think you are confusing this with the "Custom HTML" macro maybe?

This looks like a more concise solution with fewer dependencies and would be less likely to break:

https://answers.atlassian.com/questions/249722

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

599 views 20 11
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