?
avatar ghost
ghost
9 Sep 2014

This is not only an issue of form field type "tag" but also for any multiple form field with class that

extends JFormFieldList

Steps to reproduce the issue

1) In an article add 2 or 3 tags. Save article. Close it.
2) In
/components/com_content/views/article/tmpl/edit.php
after
defined('_JEXEC') or die;
add line
$this->form->setFieldAttribute('tags', 'readonly', 'true');

OR(!)

add a readonly attribute to field definition of "tags" in
/components/com_content/models/forms/article.xml

field name="tags"
type="tag"
label="JTAG"
description="JTAG_DESC"
class="span12"
multiple="true"
readonly="true"

3) Set error reporting in Joomla configuration to maximum.
4) Reopen article of step 1).
5) You'll see a PHP warning
htmlspecialchars() expects parameter 1 to be string, array given in /libraries/joomla/form/fields/list.php on line 66
6) In disabled tags field you'll see your tags.
7) Save article.

Tags field is now empty and tag assignments to this article are removed from database

Additional comments

In /libraries/joomla/form/fields/list.php if readonly is active for a select box a hidden field is created that throws above warning/error because form field e.g. of type tag (extends JFormFieldList) sends $this->value as an array not as a single value.

PR #4261

avatar illovo illovo - open - 9 Sep 2014
avatar illovo illovo - change - 9 Sep 2014
Category Libraries
avatar illovo illovo - change - 9 Sep 2014
The description was changed
Title
readonly form field tag throws warning in list.php
readonly form field tag throws warning in list.php and deletes tags
avatar illovo illovo - change - 9 Sep 2014
Title
readonly form field tag throws warning in list.php and deletes tags
readonly form field tag throws warning in list.php and deletes assigned tags
avatar illovo illovo - change - 9 Sep 2014
The description was changed
avatar illovo illovo - change - 9 Sep 2014
The description was changed
avatar brianteeman
brianteeman - comment - 10 Sep 2014

With the new system you dont need to create an issue here if you are going to create a PR on github as the two systems are in sync. I am closing this in favour of #4261 so we only have one issue

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar brianteeman brianteeman - change - 10 Sep 2014
Status New Closed
avatar brianteeman brianteeman - close - 10 Sep 2014
avatar brianteeman brianteeman - close - 10 Sep 2014
avatar zero-24 zero-24 - close - 10 Sep 2014
avatar brianteeman brianteeman - change - 10 Sep 2014
Closed_Date 0000-00-00 00:00:00 2014-09-10 09:16:23
avatar colivier colivier - reference | - 24 Feb 15
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment