Skip to main content
1 of 2
cappu
  • 169
  • 9

Cannot access form in Joomla 4 frontend

In Joomla 4.3.4 I have created a menu item Create Article for a specific category. When I try to access this edit view I get the following error:

0 htmlspecialchars(): Argument #1 ($string) must be of type string, array given

The call stack looks like this:

#   Function    Location
1   ()  JROOT/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php:103
2   htmlspecialchars()  JROOT/administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php:103
3   include()   JROOT/libraries/src/Layout/FileLayout.php:128
4   Joomla\CMS\Layout\FileLayout->render()  JROOT/administrator/components/com_categories/src/Field/CategoryeditField.php:369
5   Joomla\Component\Categories\Administrator\Field\CategoryeditField->getInput()   JROOT/libraries/src/Form/FormField.php:1029
6   Joomla\CMS\Form\FormField->renderField()    JROOT/libraries/src/Form/Form.php:536
7   Joomla\CMS\Form\Form->renderField() JROOT/components/com_content/tmpl/form/edit.php:106
8   include()   JROOT/libraries/src/MVC/View/HtmlView.php:410
9   Joomla\CMS\MVC\View\HtmlView->loadTemplate()    JROOT/libraries/src/MVC/View/HtmlView.php:203
10  Joomla\CMS\MVC\View\HtmlView->display() JROOT/components/com_content/src/View/Form/HtmlView.php:197
11  Joomla\Component\Content\Site\View\Form\HtmlView->display() JROOT/libraries/src/MVC/Controller/BaseController.php:645
12  Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/src/Controller/DisplayController.php:121
13  Joomla\Component\Content\Site\Controller\DisplayController->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:678
14  Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
15  Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()   JROOT/components/com_content/src/Dispatcher/Dispatcher.php:56
16  Joomla\Component\Content\Site\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
17  Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:208
18  Joomla\CMS\Application\SiteApplication->dispatch()  JROOT/libraries/src/Application/SiteApplication.php:249
19  Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
20  Joomla\CMS\Application\CMSApplication->execute()    JROOT/includes/app.php:61
21  require_once()  JROOT/index.php:32

The code around line 103 of administrator/components/com_categories/layouts/joomla/form/field/categoryedit.php is as follows:

 94    if ($multiple && is_array($value)) {
 95        if (!count($value)) {
 96            $value[] = '';
 97        }
 98
 99.       foreach ($value as $val) {
100            $html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
101        }
102    } else {
103        $html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value , ENT_COMPAT, 'UTF-8') . '">';
104    }```

What am I missing?
cappu
  • 169
  • 9