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