Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

UploadField in Widget


Reply


4 Posts   874 Views

Avatar
Blackthorn87

Community Member, 27 Posts

20 February 2013 at 6:44am

Hi Guys,

I'm trying to add an 'UploadField' to a widget in SilverStripe 3.0, but can't seem to get anywhere with it.

I get the error:

Fatal error: Call to a member function FormAction() on a non-object in /home/amberlei/public_html/framework/forms/FormField.php on line 139

I know there was a similar error prior to SilverStripe 3.0 for the 'ImageField', but I thought it would be fixed in the newer version. Does anyone know how to successfully add an 'UploadField' in SS 3.0?

It would be nice to have this just work rather use a work around, but if that's necessary then that's cool.

Thanks in advance, any help is appreciated.

Avatar
swaiba

Forum Moderator, 1808 Posts

20 February 2013 at 8:45am

I can only talk about the 2.4.x, but as I understand it widgets are a "port" from that code (i.e. not rediesigned since 2.4.x) and as such an uploadfield was unworkable in terms of the old system. So instead I created a LinkWidget (http://www.silverstripe.org/imagelinkwidget-widget/ - boy what a plug!) to link to uploads in the normal fashion.

Love to know this is fixed, but in case it isn't the above is the best workaround I know

Avatar
Blackthorn87

Community Member, 27 Posts

20 February 2013 at 10:20pm

Edited: 20/02/2013 10:33pm

Hi Swaiba,

Thanks for such a quick reply. I tried installing the widget you linked to but when I try to add the widget to a page I get this error:

Error at line 568 of /home/amberlei/public_html/framework/model/MySQLDatabase.php

I also remember the widget as I used a modded version of it for a project I was working on last year. It works very well on SilverStripe 2.4.x but on SilverStripe 3.x I get the error mentioned above.

I don't suppose you have any ideas on what the problem could be?

Thanks again.

EDIT: I have checked the site and it is in dev mode, so any ideas where could I find more information?

Avatar
swaiba

Forum Moderator, 1808 Posts

20 February 2013 at 10:25pm

I suspect it will be many things! I know this sort of thing...

$fields->push(new TextField(...):

...is depreciated in SS3. If that helps, but it doesn't look like that error... sorry can't help any more as I'm not on SS3 yet