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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

TreeDropdownField for the Widget

Go to End

2 Posts   2634 Views


7 Posts

22 November 2007 at 7:57pm

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

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


Community Member, 20 Posts

1 June 2008 at 9:28pm

Edited: 01/06/2008 9:29pm

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