Project

General

Profile

Actions

Bug #17621

closed

Insertion of more than one items by the Element Browser is allowed when it shouldn't

Added by Kostas Petrianakis about 17 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2007-09-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
5.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The backend interface allows to select more than one items by the Element Browser for fields that take references to pages or files and should allow only one item to be inserted.

See proposed solution bellow:

Replace the generated Javascript function: setFormValueOpenBrowser
within the function: dbFileCon
in the file: t3lib/class.t3lib_tceforms.php (line:4761)
with this:

function setFormValueOpenBrowser(mode,params) { //
var cmltemp = new Array();
cmltemp = params.split(\'|\');
var cmlname = cmltemp0;
cmlObj = '.$formObj.'[cmlname+"_list"];
if(cmlObj){
var len = cmlObj.length;
if(cmlObj.size==1 && len>=1){
alert(\'This field takes only one item. Please remove the existing one before attempting to input another.\');
return false;
}
}
var url = "'.$this->backPath.'browser.php?mode="+mode+"&bparams="+params;

browserWin = window.open(url,"Typo3WinBrowser","height=350,width="+(mode=="db"?650:600)+",status=0,menubar=0,resizable=1,scrollbars=1");
browserWin.focus();
}

(issue imported from #M6372)


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #20422: TCEForm does not replace the existing element if adding a new element to a field with maxitems=1Closed2009-05-14

Actions
Actions #1

Updated by Kostas Petrianakis about 17 years ago

Anyone want to integrate this to the source code??

Actions #2

Updated by Oliver Hader about 17 years ago

I can confirm this issue.
But there are other cases that have to be implemented.
You did a work-around if the size of a selector was set to 1. But it's also possible, that there are 10 items allowed (maxitems=10 in TCA) - thus, the element browser shouldn't be allowed to insert more, if there are already 10 items.

I also might happen, that you have no items yet in your forms field, open the Element Browser and insert and item (without closing the Element Browser), then insert another item which isn't allowed if maxitems=1. Thus, the check against maxitems should furthermore be delegated to the Element Browser.

Actions #3

Updated by Oliver Hader about 17 years ago

If you create further patches, please provide them in a unified format, e.g. under linux type:
#> diff -ru typo3.orig/ typo3.modified/

Actions #4

Updated by Benni Mack over 15 years ago

The problem is now solved for fields with size=1. For selects with a bigger size, there is an option to scroll, position and see multiple items, thus the behaviour is different and good in that way. So we have this now:

  • If the size of the select is 1, then there is no sorting option, there is not even a way to see that there are multiple items. Thus, if there is only one item allowed, then there should always be one item in there.
  • If the size of the select is more than one, then you can scroll through the items if there are more items than the size of the select. If there is a maxitems restriction, then there will be a exclamation mark item if you have too many items in there. You can scroll through the list and remove the appropriate item.
Actions

Also available in: Atom PDF