21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1779 Views |
-
FileIFrameField not working in getCMSFields_forPopup

22 January 2009 at 11:48pm
Hi,
I'm trying to attach multiple files to a page. I'm using HasManyComplexTableField and FileIFrameField.
I get the following error on the pop-up window:Notice: Trying to get property of non-object in C:\Projects\myproject\src\sapphire\forms\FileIFrameField.php on line 18
What am I doing wrong?
Here is my code:
<?php
class Project extends Page
{
static $db = array(
);static $has_one = array(
);
static $has_many = array(
'ProjectAssets' => 'ProjectAsset',
);function getCMSFields()
{
$fields = parent::getCMSFields();$tablefield = new HasManyComplexTableField(
$this,
'ProjectAssets',
'ProjectAsset',
array(
'FileTitle' => 'Title'
),
'getCMSFields_forPopup'
);
$tablefield->setAddTitle('file');
$fields->addFieldToTab( 'Root.Content.Files', $tablefield );return $fields;
}
}class Project_Controller extends Page_Controller
{
}?>
<?phpclass ProjectAsset extends DataObject {
static $db = array(
'FileTitle' => 'Varchar(200)'
);
static $has_one = array(
'Project' => 'Project',
'File' => 'File'
);
function getCMSFields_forPopup() {
return new FieldSet(
new TextField('FileTitle', 'Title'),
new FileIFrameField('File')
);
}
}?>
-
Re: FileIFrameField not working in getCMSFields_forPopup

23 January 2009 at 4:16am
This is a known bug. Look at line 18 of FileIFrameField in /sapphire/forms. You'll see it's trying to access a variable that may not necessarily be defined (I believe it's called $data). Use the isset() function to determine if the variable is set before going any further.
-
Re: FileIFrameField not working in getCMSFields_forPopup

23 January 2009 at 7:32am
That fixed it. Thanks Uncle cheese!
| 1779 Views | ||
|
Page:
1
|
Go to Top |

