Making "Change Comment" field mandatory

We want to force users to add a revision comment when a file gets a new version, so we can see a summary at the history of that file. How can we make “Change Comment” field (at the “File Edit” window) as mandatory to force users to write revision comments?

1 votes

1 answers

679 views

ANSWER



You can override the “document_edit.xhtml” template and make the textarea mandatory by adding the property required=“true” to it.

1 votes



Thank you for quick answer,

I have changed the related line as you said; <h:inputTextarea value="#{currentDocument.contextData['request/comment']}" required="true" />

That worked, "Save" button doesn't allow me to make a version increment without adding a comment. But there is no sign about this field is mandatory and if you click "Save", no information about the reason of failure. I was thinking a change like a red * icon too as "Title" field has. I have to give at least one of them to users (red * or information about that field is mandatory).

Another thing is; my edit is not permanent, whenever I restart/force-reload the nuxeo server, the line returns to it's previous version.

02/20/2012

For the red * to appear just change the class on the "td" element around the label: class="labelColumn required"

And changes to xhtml files are not persisted: you have to override this template in your own plugin.

02/20/2012

If you made the change to the XHTML file on the running server then the next time the server stops/starts the nuxeo WAR will be redeployed and erase your changes. To make this permanent you need to make a contribution to override the default document_edit.xhtml file.
02/20/2012

Ok, I think I got how it works. The rest is not problem. Thank you so much.
02/20/2012