21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 352 Views |
-
SS3 Beta UploadField on DataObject issues

22 March 2012 at 10:04pm Last edited: 22 March 2012 10:06pm
Hi All,
Not sure if I'm missing something here or maybe someone can tell me this is a know issue.
I have a simple DataObject called 'Brand' like so...
class Brand extends DataObject {
static $db = array(
"Title" => "Varchar(256)",
"WebsiteLink" => "Varchar(256)"
);public static $has_one = array(
"HomePage" => "HomePage",
"Logo" => "Image"
);public static $summary_fields = array(
'Title'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new TextField("Title", "Title"));
$fields->addFieldToTab("Root.Main", new TextField("WebsiteLink", "Website Link"));
$fields->addFieldToTab("Root.Main", new UploadField("Logo"));
$fields->removeFieldFromTab("Root.Main", "HomePageID");
return $fields;
}
}And 'Brands' can be added to a page using the new GridField like:
$brandsConfig = new GridFieldConfig_RelationEditor();
$brandsTable = new GridField("Brands","Brands",$this->Brands(),$brandsConfig);everything so far is cool BUT when I try to attach a image to a 'Brand' object (adding or editing) it seems the form action is messing up and the DataObject has no controller action kicking in to deal with the 'upload' method... it returns a 404.... eg:
http://zqpublic.nimeso/admin/page/edit/EditForm/field/Brands/item/1/ItemEditForm/field/Logo/upload (Wont work)
http://zqpublic.nimeso/admin/page/edit/EditForm/field/HeaderImage/upload (Will work - used in my base Page class)
Cheers guys! Great job so far! looking Asum!
-
Re: SS3 Beta UploadField on DataObject issues

21 May 2012 at 11:13am
Hi nimesodelta,
The problem is that when an image is uploaded, it cannot make a link (LogoID) back to Brand dataobject since the Brand has not been actually created at the time the image is uploaded. A Brand data object is actually created when you click Create button.
If you try to save (create) a Brand first and then upload a image, it works fine...I know this is not a solution but hope the info is helpful.
Let me know if you can fix the problem
Cheers,
| 352 Views | ||
|
Page:
1
|
Go to Top |

