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.

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   2977 Views

Avatar
Val

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

Avatar
Blynx

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