Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » File edit/delete buttons dissapear in multiple files uploadfield after 'save & publish'

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 417 Views
  • Friksel
    Avatar
    Community Member
    7 Posts

    File edit/delete buttons dissapear in multiple files uploadfield after 'save & publish' Link to this post

    Hi Silverstripers,

    Somehow I can't find a way to get thisone working;

    I extended Page with a has_many relation to multiple Files and overwritten getCMSFields to show an uploadfield in the CMS.
    I use Silverstripe 3.02.

    Everything looks fine in the CMS; users can upload one or more files on this page and the upload field automaticaly expands to handle more files to upload. All files have an edit- and an delete-button next to it. But somehow these buttons magicaly dissapear when the user saves & publishes the page. And they never come back....

    I looked everywhere on Google, but can't find anybody having the same problem.

    A solution or workaround to this problem is highly appreciated!!
    Anybody?

    This is my code:

    class pageWithDocs extends Page {
       static $has_many = array(
          'AttachedDocuments' => 'File'
       );

       public function getCMSFields() {
          $fields = parent::getCMSFields();

          $fields->addFieldToTab('Root.Main', new UploadField('AttachedDocuments', 'Documenten', $this->AttachedDocuments()));
                
          return $fields;
       }
    }

  • IOTI
    Avatar
    Community Member
    189 Posts

    Re: File edit/delete buttons dissapear in multiple files uploadfield after 'save & publish' Link to this post

    Try changing your relationship from a $has_many to a $many_many. I know it doesn't really make sense but it seemed to help me when i was having issues with UploadField. don't forget to /dev/build!

  • Friksel
    Avatar
    Community Member
    7 Posts

    Re: File edit/delete buttons dissapear in multiple files uploadfield after 'save & publish' Link to this post

    That was it! Thanks a lot IOTI!!!

    417 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.