/** Author: childno͡.de **/varvalOnSaveMsg="PLEASE insert a text into the change message field or uncheck the notifications if you only made minor / typo changes. Thank you!"AJS.$(document).on("valOnSaveMsg",function(e,useDialog){if(!useDialog){Confluence.EditorNotification.notify("error",valOnSaveMsg,10)return;}(function(){vardialog=newAJS.Dialog({width:500,height:200,id:"warn-on-save-empty-versioncomment",closeOnOutsideClick:true});dialog.addHeader("oh no","aui-lozenge-error");dialog.addPanel("PLEASE","<p>"+valOnSaveMsg+"</p>","panel-body");dialog.addLink("Dismiss",function(dialog){dialog.hide();},"#");dialog.gotoPage(0);dialog.gotoPanel(0);dialog.show();})()});AJS.$(document).ready(function(){// known bug: submit is also done by cancel actionAJS.$("form#editpageform").on("submit",function(e){if(AJS.$("input#notifyWatchers").attr("checked")&&AJS.$("input#versionComment")[0].value.trim().length==0){e.preventDefault();// use notification instead of dialogAJS.$(document).trigger("valOnSaveMsg",[false]);Confluence.Editor.UI.toggleSavebarBusy(false);Confluence.Editor.isCancelling=true}})})
You might do better validation by using HTML5 constraint validations (http://www.html5rocks.com/en/tutorials/forms/constraintvalidation/) but unfortunatly I'm not familar with that atm
this is discussed on https://answers.atlassian.com/questions/17893650