Issue Bug Closed

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

Kostas Petrianakis 09/19/07, 20:43 updated 08/06/10, 13:24

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)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.