Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » TreeDropdownField for the Widget

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2112 Views
  • Val
    Avatar
    7 Posts

    TreeDropdownField for the Widget Link to this post

    I am trying to create a global Widget. One of the fields in the Widget should be TreeDropdownField. I've managed to display it correctly by using the following code:

    public function getCMSFields() {
    $folder = new TreeDropdownField( 'FolderID', 'Show The Files From', 'Folder' );
    $folder->setFilterFunction( create_function( '$obj', 'return $obj->class == "Folder";' ) );
    return new FieldSet($folder);
    }

    when I am trying to view it and click on the drop down field, I am getting AJAX error that is thrown by sapphire\forms\Form.php, Form::callfieldmethod().

    After executing the following URL
    http://localhost/admin/?executeForm=EditForm&action_callfieldmethod=1&fieldName=Widget[44][FolderID]&ajax=1&SecurityID=32401&methodName=gettree&forceValues=0

    ERROR:Error 256: Form::callfieldmethod() Field 'Widget[44][FolderID]' not found At l590 in .....\sapphire\forms\Form.php user_error(Form::callfieldmethod() Field 'Widget[44][FolderID]' not found,256) line 590 of Form.php Form->callfieldmethod(Array,Form) line 191 of Controller.php Controller->run(Array) line 76 of Director.php Director::direct(/admin/) line 104 of main.php

    It seems that I can't have [ ]brackets as a fieldName parameter for this particular case.
    Is there any way around this, it would be nice to have an option to display random images from the gallery

  • Blynx
    Avatar
    Community Member
    20 Posts

    Re: TreeDropdownField for the Widget Link to this post

    Did you find any fix to this issue yet? I'm just having the same problem...

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