Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » UploadField in Widget

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 752 Views
  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    UploadField in Widget Link to this post

    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.

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: UploadField in Widget Link to this post

    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

  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    Re: UploadField in Widget Link to this post

    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?

  • swaiba
    Avatar
    Forum Moderator
    1792 Posts

    Re: UploadField in Widget Link to this post

    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

    752 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.