?
avatar AdityaTaware
AdityaTaware
2 Nov 2019

Steps to reproduce the issue

  1. Go to Menu -> Create menu.
  2. Add Title.
  3. Add blank space in the Unique Name field.
  4. Click on the Save button.

Expected result

The error message should show the correct field name.

Actual result

Wrong field name show inscreen shot 2019-11-02 at 12 32 41 error message.

System information (as much as possible)

Additional comments

avatar AdityaTaware AdityaTaware - open - 2 Nov 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Nov 2019
avatar infograf768
infograf768 - comment - 2 Nov 2019

I guess we have to trim $data['menutype']) to make sure it never tries to save the field with a blank space.
If trimmed, the error will be Field required: Unique Name

avatar astridx
astridx - comment - 2 Nov 2019

I just tried this (after git pull origin 4.0-dev on Ubuntu with Firefox) and I get the error Field required: Unique Name
Menus  Add   test   Administration

avatar infograf768
infograf768 - comment - 3 Nov 2019

@astridx
Have you entered a blank space in the field before saving? If you do, then you will get the error Menu type empty.

To avoid this scenario, we can use this patch to get the Field required: Unique Name as anyway it is not a good idea to have some spaces around the Unique name.

diff --git a/administrator/components/com_menus/Controller/MenuController.php b/administrator/components/com_menus/Controller/MenuController.php
index 984bcc1..b3736c0 100644
--- a/administrator/components/com_menus/Controller/MenuController.php
+++ b/administrator/components/com_menus/Controller/MenuController.php
@@ -13,4 +13,5 @@
 
 use Joomla\CMS\Language\Text;
+use Joomla\CMS\Filter\InputFilter;
 use Joomla\CMS\MVC\Controller\FormController;
 use Joomla\CMS\Router\Route;
@@ -71,4 +72,6 @@
 		}
 
+		$data['menutype'] = InputFilter::getInstance()->clean($data['menutype'], 'TRIM');
+
 		// Populate the row id from the session.
 		$data['id'] = $recordId;
avatar astridx
astridx - comment - 3 Nov 2019

@infograf768 I was sure that I entered a space - but I probably do not have this. I just tested it again and now I can confirm the issue.

avatar infograf768
infograf768 - comment - 3 Nov 2019

will make PR later.

avatar brianteeman
brianteeman - comment - 4 Nov 2019

@infograf768 did you forget or was there a difficulty

avatar joomla-cms-bot joomla-cms-bot - change - 3 Dec 2019
Closed_By alikon joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 3 Dec 2019
avatar alikon alikon - change - 3 Dec 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-12-03 16:35:02
Closed_By alikon
avatar joomla-cms-bot
joomla-cms-bot - comment - 3 Dec 2019

Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/26948

avatar alikon
alikon - comment - 3 Dec 2019

please test #27206


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/26948.

avatar infograf768
infograf768 - comment - 4 Dec 2019

@infograf768 did you forget or was there a difficulty

I just forgot... Thanks @alikon

Add a Comment

Login with GitHub to post a comment