21474 Posts in 5781 Topics by 2620 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 921 Views |
-
PopUp form that not popup

7 January 2010 at 3:45am
Hi,
I've created a dataobject for add multiple iamge to an object.
public function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Name', 'Name'));
$fields->push(new ImageField('Image', 'Image'));return $fields;
}$my_imagetable = new DataObjectManager(
$this,
'ProductImageAttachments',
'Product_ImageAttachment',
Product_ImageAttachment::$field_names,
Product_ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);why form don't popup, but open a normal page and then I must press "back" to return admin and F5 to update node?
-
Re: PopUp form that not popup

7 January 2010 at 12:31pm
...
Product_ImageAttachment::$field_names,
Product_ImageAttachment::getCMSFields_forPopup(),
...is very wrong.
You should pass an array of the column name and the field you want to show as the first of those two.
the second should be a string of the name of the function to callback. -
Re: PopUp form that not popup

8 January 2010 at 12:12am
This Product_ImageAttachment::$field_names is an array:
static $field_names = array('Thumbnail' => 'Image','Name' => 'Name');
and the second Product_ImageAttachment::getCMSFields_forPopup() is
public function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Name', 'Name'));
$fields->push(new ImageField('Image', 'Image'));return $fields;
}into class Product_ImageAttachment extends DataObject
The problem is that the form where are input fields is opend not in popup window but in the same admin page...
Why?
-
Re: PopUp form that not popup

10 January 2010 at 2:51pm Last edited: 10 January 2010 2:57pm
You are currently passing it an array and a function.
As i said before, it needs to be an array and a string.
I am not sure why it is opening in the same window and not a pop-up; but i have a feeling it is because you are implementing the DataObjectManager object incorrectly and not as i have stated you should.
EDIT:
Here is the code to use:$my_imagetable = new DataObjectManager(
$this,
'ProductImageAttachments',
'Product_ImageAttachment',
array('Thumbnail' => 'Image', 'Name' => 'Name'),
'getCMSFields_forPopup', // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);
| 921 Views | ||
|
Page:
1
|
Go to Top |

