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.

Customising the CMS /

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

Silverstripe 3.0: Fetch a Listbox field which has not been created in database


Go to End


1066 Views

Avatar
Neelam

Community Member, 15 Posts

8 June 2013 at 4:22am

Edited: 08/06/2013 4:32pm


I have used DataExtension on Group Class and the canView() function to hide certain groups based on conditions

But this canView is not applied to the groups listbox which is applied while editing a member/ or group drop down while adding new groups

So I need to set the source of the list box through code

I used

updateCMSFields(FieldList $fields){

$grplisting = $fields->dataFieldByName('DirectGroups'); ...

}

but this is not returning anything so i am not able to use $grplisting->setSource() on it....to filter the source based on the canView conditions also...

can some one please help me out on how I can show the filtered group values in this drop down?

Note: As far as I have observed this field is not created in the database and involves a $belongs_many_many relationship..i have also tried using $fields->fieldByName()