Joomla-cms: Malformed menuitem allows article and category creation - Require category selction if Create Article in specific category in selected

Created on 24 Aug 2017  路  9Comments  路  Source: joomla/joomla-cms

Steps to reproduce the issue

In J!3.7.5 one can save a Create Article menu item, settting "Default Category" to Yes and NOT filling the "Choose a Category" field.

Expected result

Joomla! refuses to save menu item.

Actual result

Joomla! saves the menu item.
In frontend, using that menu with such a setting, forces to save the article in a newly created category with name '1' !

System information (as much as possible)

J!3.7.5 (and probably all previous versions)

Additional comments

Bug detected thanks by @infograf768 while testing PR #17674 .

We need a way to make 'catid' (Choose a Category) form field param required (\components\com_content\views\form\tmpl\edit.xml) when enable_category param (Default/Specific category) is active.
A new "requiredon:..." attribute, working like "showon:..." ?
A way to require validation of that attribute in the backend from ?

J3 Issue No Code Attached Yet

All 9 comments

Regardless of the parameter being required

proper behaviour would be that
setting "Default category" to Yes and not selecting a category

  • should behave like "Default category" is OFF,

i mean code (when possible) should anticipate bad configuration
and work in a proper way, regardless of user input

I agree with your suggested behaviour (it's now merged in #17674).
Anyway I think that the "Selected category" should be 'required' if Default category is ON and the user should be blocked on saving or at least receive an alert saying that without selecting a category there won't be any constraints on the category, as if 'enable_category' is OFF.

A new "requiredon:..." attribute, working like "showon:..." ?

I like this idea.

btw, the issue is in any J version, including staging.

@infograf768 is this still an issue ?

yes

let me have a look at this a bit. I think that we could set the field as required when Default Category is set to Yes

hmm, not so simple...

Closing as we have a patch.
Please test https://github.com/joomla/joomla-cms/pull/25798

Was this page helpful?
0 / 5 - 0 ratings