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.

We've moved the forum!

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.

Form Questions /

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

ComplexTableField on Front End


Go to End


3 Posts   1803 Views

Avatar
Jnauta

Community Member, 8 Posts

28 June 2011 at 6:40am

I have created several dataobjects that ia wish users to edit from the front end. I can get the ComplexTableField to display the list of DataObjects associated with the user's account, however I can not get the front end forms to allow adding and editing. Any Thoughts?

Controller

    public function libraryDocuments()
    {
        $fdo = new ComplexTableField(
            $this, 
            'MyDocs',
            'LibarayItem',
            '',
            'CustomCMSFields_forPopup'
        );
        $fdo->setParentClass(false);
        
        $fields = new FieldSet(array(
            new HiddenField('ID', ''),
            $fdo,
        ));
        
        $actions = new FieldSet(array(
            new FormAction ('saveLibraryDocs','Save'),
        ));
        
       //$actions = new FieldSet(); 
        
        return new Form($this, 'libraryDocuments', $fields, $actions);
    }

Avatar
zenmonkey

Community Member, 545 Posts

23 July 2011 at 8:30am

Off the top of my head, I'd say the Page_Controller doesn't have access to those controllers. I know I've used ComplexTableFields in the front end, but I've always removed those functions. Have you tried specifically setting the permissions?

http://api.silverstripe.org/2.4/forms/fields-relational/ComplexTableField.html#var$permissions

Avatar
Jnauta

Community Member, 8 Posts

26 July 2011 at 1:03am

I was able to get this working, it was a simple permissions issue on the dataobject. I neeted to implment PermissionsProvider and add the can(?) Access to the dataobject in question.