2

I am using Joomla 3.6.5. On my site I allow registered Authors to add articles.

"Version Note" is one of the fields but it is optional.

I want to make it mandatory. I have enabled versioning for articles.

How can I make this field mandatory?

Thx

0

As Terry says, the best way to do this (without editing or overriding the code) is probably to add some JavaScript to the page.

Based on the answer at: https://stackoverflow.com/a/10034643/1983389 the JavaScript code will probably look something like this:

window.addEvent('domready', function() {
  $("#jform_version_note").attr('required','required');
});

You can add the JavaScript using a third party extension such as one of the following:

1

I haven't found a Joomla setting that makes it required. You could add a plug in that fires a Javascript after page load, adding the required attribute to that element though. Could probably even add some jquery script to the head of your site that forces required.

1

Although I accepted Neil's answer, I found an easier method to do this. But my method may not appeal to many since it requires changing XML files of default Joomla installation. Perhaps there's a way to write a custom XML to override the settings selectively in the default XML.

Article form settings are available in these files:

administrator/components/com_content/models/forms/article.xml (backend)
components/com_content/models/forms/article.xml (frontend)

To the version_note field, I added an extra attribute:

required="true"

Though not directly relevant to the question, I would like to add that only the form settings are in XML. Global article options themselves are stored in the #_extensions database table in params column for name='com_content'. For versioning, applicable fields are save_history and history_limit. In addition, every article can override the global options but versioning is one of those features for which article-level overriding is not possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.