Bug #23552

TCE_Forms Select & group fields remove item bug (have seen #0014599)

Added by Aske Ertmann almost 9 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Should have
Category:
Backend User Interface
Target version:
Start date:
2010-09-17
Due date:
% Done:

100%

TYPO3 Version:
4.4
PHP Version:
5.2
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

Hello,

I've been having this problem for a while now, and I finally checked the bug tracker for the issue. The issue is there (#0014599) but has been closed because of problems with reproducing it. Anyway I've got a bit more into the code and can very much reproduce the problem, also with the latest trunk version of class.t3lib_tceforms.php where the javascript is inlined.

Here's the problem: Having selected multiple items in a group or select field. Then trying to remove a single item results in removing all the items.

The solution is very simple by changing fObjSel.size to fObjSel.length (which is already set as the var "l") in line 5637:
(type=="Remove" && fObjSel.size > 1) to (type=="Remove" && l > 1).
This validates the if if there's more than 1 elements in the selected options.

Can although also just be changed to fObjSel.length if preferred.

Related to #0014599
(issue imported from #M15731)

patch_tceforms.diff View (500 Bytes) Administrator Admin, 2010-09-17 12:18

Screen_Shot_2013-10-30_at_19.03.44.png View (42.8 KB) Bjorn Kuipers, 2013-10-30 19:13

Screen_Shot_2013-10-30_at_19.03.56.png View (39.7 KB) Bjorn Kuipers, 2013-10-30 19:13

Associated revisions

Revision d8bc2728 (diff)
Added by Christian Plattner over 5 years ago

[BUGFIX] Default size for group-type fields

Missing size property on group-type fields causes various
problems, like missing controls (move to top and move to
bottom) or misbehaving JS. Adding a default size ensures
that a forgotten size property does not break everything.

Additionally the size property is added to the sys_collection
table, since all Core tables should be cleanly defined.

Resolves: #23552
Documentation: #56627
Releases: 6.1, 6.2
Change-Id: Idafb1912f9702fddf85b7c2c222f408419e50ecf
Reviewed-on: https://review.typo3.org/28116
Reviewed-by: Markus Klein
Tested-by: Markus Klein

Revision e61b2cfa (diff)
Added by Christian Plattner over 5 years ago

[BUGFIX] Default size for group-type fields

Missing size property on group-type fields causes various
problems, like missing controls (move to top and move to
bottom) or misbehaving JS. Adding a default size ensures
that a forgotten size property does not break everything.

Additionally the size property is added to the sys_collection
table, since all Core tables should be cleanly defined.

Resolves: #23552
Documentation: #56627
Releases: 6.1, 6.2
Change-Id: Idafb1912f9702fddf85b7c2c222f408419e50ecf
Reviewed-on: https://review.typo3.org/28129
Reviewed-by: Markus Klein
Tested-by: Markus Klein

History

#1 Updated by Aske Ertmann almost 9 years ago

Here a screencast reproducing the issue: http://screencast.com/t/OTY0YmRi

Btw. the function the remove button calls is setFormValueManipulate where this issue lies.

#2 Updated by Dmitry Dulepov almost 9 years ago

Can't reproduce the issue.

Note that 'length' property shows how many <option> elements are in the <select>, not how many selected elements.

#3 Updated by Lars Malach almost 9 years ago

Can't reproduce the issue too.

Aske, can you send us the extension key or the t3x-file? And exists this issue in every webbrowser or in one specific?

#4 Updated by Fedir RYKHTIK over 6 years ago

  • Target version deleted (0)

Bug still exists in 4.5.22.
Google Chrome Version 23.0.1271.97
Changing fObjSel.size to fObjSel.length resolve the issue.
Thanks, Aske !

#5 Updated by Bart Lammers over 6 years ago

This issue still exists.
Tested with version 4.5.25 and 4.7.10

Change mentioned before this solves it.

Browser: Firefox 19.0.2

#6 Updated by Einar Gislason almost 6 years ago

I'm having this issue with TYPO3 6.1.3
I have a flexform inside a content element and when trying to remove a single item they all get removed.

Flexform:

<settings.tabs>
    <TCEforms>
        <label>Some random label...</label>
        <config>
            <type>group</type>
            <internal_type>db</internal_type>
            <allowed>tt_content</allowed>
            <maxitems>10</maxitems>
            <show_thumbs>1</show_thumbs>
            <wizards>
                <suggest>
                    <type>suggest</type>
                </suggest>
            </wizards>    
        </config>
    </TCEforms>
</settings.tabs>

#7 Updated by Fedir RYKHTIK almost 6 years ago

Hey, how to push the patch into the core ? We have multiple confirmations !

#8 Updated by Bjorn Kuipers almost 6 years ago

I have the same issue in TYPO3 6.1.5 for managing the items in a Record Collection.

When creating a Record Collection of type 'static record composition' and that holds a custom table records, removing a single item is not possible. The whole list is cleared when attempting to do so. See attached screenshots.

The strange thing is the same button, same TYPO3-site, does work as expected with usergroups on a user.

The only difference I noticed was the option's value. For usergroups the value is numeric, while for the Record Collection items it will contain the tablename + uid. Maybe this has to do with it?

Here is the Javascript that is executed onclick. First one is for usergroups, and second one the items of a Record Collection. (The uid matches for the sys_collection.)

setFormValueManipulate('data[fe_users][164][usergroup]','Remove'); return false
setFormValueManipulate('data[sys_collection][3][items]','Remove'); return false

#9 Updated by Jonathan Krusy over 5 years ago

I can confirm this issue with version 6.1.7
I also had a group-element set by a flexform inside a plugin.

Adding <size>any number</size> to my flexform, solved this issue for me.

#10 Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28116

#11 Updated by Francois Suter over 5 years ago

  • Category set to Backend User Interface
  • Assignee set to Francois Suter
  • Complexity set to easy
  • Is Regression set to No

See my comment on Gerrit for another take on the matter. The problem is related to missing size property. The better solution IMO is to set a default size when rendering such a field.

#12 Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28116

#13 Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28116

#14 Updated by Gerrit Code Review over 5 years ago

Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28129

#15 Updated by Christian Plattner over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#16 Updated by Benni Mack 11 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF