Has anyone created a image field in the CMS form popup?
I'm getting this error.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Has anyone created a image field in the CMS form popup?
I'm getting this error.
I post the image
Here is the error. It's happens when I tried to upload a image from the form of the CMS popup, I just did the form exactly like the this tutorial: http://doc.silverstripe.com/doku.php?id=tutorial:5-dataobject-relationship-management
Error:
===================================
ERROR:Error 256: File::loadUploaded() Not passed an array. Most likely, the form hasn't got the right
enctype
At l152 in C:\xampp\htdocs\vancouverlivingdev\sapphire\filesystem\File.php
user_error(File::loadUploaded() Not passed an array. Most likely, the form hasn't got the right enctype
,256)
line 152 of File.php
File->loadUploaded()
line 113 of Image.php
Image->loadUploaded()
line 14 of SimpleImageField.php
SimpleImageField->saveInto(WhatsHotWhatsNOTDataObject)
line 543 of Form.php
Form->saveInto(WhatsHotWhatsNOTDataObject)
line 702 of ComplexTableField.php
ComplexTableField_Popup->saveComplexTableField(Array,ComplexTableField_Popup)
line 197 of Controller.php
Controller->run(Array)
line 76 of Director.php
Director::direct(/admin/)
line 104 of main.php
Code:
======================
// lists
function getCMSFields()
{
$fields = parent::getCMSFields();
$tablefield = new HasManyComplexTableField(
$this,
'Posts',
'WhatsHotWhatsNOTDataObject',
array(
"Whats" => "Whats HOT Whats NOT",
'Title' => 'Title',
'Description' => 'Description',
'VotesAgree' => 'Votes Agree',
'VotesDisagree' => 'Votes Disagree',
'Datetime' => 'Date and time',
'Active' => 'Active',
'Offensive' => 'Mark as offensive',
'Home' => 'Home'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab( 'Root.Content.Posts', $tablefield );
return $fields;
}
// CMS
function getCMSFields_forPopup()
{
$o = new FieldSet();
$o->push(
new SimpleImageField("Picture", "Image:")
);
return $o;
}
the popup form is submitted via javascript/ajax, which means you can't use file-uploads in forms. have you tried using ImageField instead of SimpleImageField? this uploads through an iframe instead, which i'm pretty sure works in the popup as well
I did, but this error is shown:
FATAL ERROR: Bad class to singleton() - WhatsHotWhatsNOTDataObject
At line 78 in C:\xampp\htdocs\vancouverlivingdev\sapphire\core\Core.php
user_error(Bad class to singleton() - WhatsHotWhatsNOTDataObject,256)
line 78 of Core.php
singleton(WhatsHotWhatsNOTDataObject)
line 1504 of DataObject.php
DataObject::get_one(WhatsHotWhatsNOTDataObject,`WhatsHotWhatsNOTDataObject`.`ID` = 1)
line 1594 of DataObject.php
DataObject::get_by_id(WhatsHotWhatsNOTDataObject,1)
line 445 of Image.php
Image_Uploader->linkedObj()
line 460 of Image.php
Image_Uploader->Image()
call_user_func_array(Array,Array)
line 294 of ViewableData.php
ViewableData->obj(Image,,1)
line 948 of ViewableData.php
ViewableData_Customised->obj(Image,,1)
line 20 of .cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ss
include(C:\Users\rochita\AppData\Local\Temp\silverstripe-cacheC--xampp-htdocs-vancouverlivingdev\.cacheC..xampp.htdocs.vancouverlivingdev.sapphire.templates.Image_iframe.ss)
line 190 of SSViewer.php
SSViewer->process(ViewableData_Customised)
line 228 of Controller.php
Controller->run(Array)
line 76 of Director.php
Director::direct(/images/iframe/WhatsHotWhatsNOTDataObject/1/Picture)
line 104 of main.php
Context
Debug (Debug::showError() in line 149 of Debug.php)
* className =
WhatsHotWhatsNOTDataObject
* _SINGLETONS =
o Member =
Database record: Member
+ ID :
0
thread subscribe
subscribe
subscribe