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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Correct use of setDisableFunction within TreeDropdownField?


Go to End


831 Views

Avatar
Turismo

Community Member, 28 Posts

26 May 2016 at 4:13am

I have a TreeDropdownField working exactly as I need it to, however I'd ideally like to disable checkboxes for all pages in the tree except for those which have the ServicePage class.

Here is my code:

$fields->addFieldToTab(
    'Root.Services',
    new TreeMultiselectField(
        'Services',
        'Related services',
        'SiteTree'
    )
);

Looked at the code suggested at the bottom of http://stackoverflow.com/questions/29171542/filter-sitetree-treedropdownfield-in-silverstripe-3-1 but not quite sure how to integrate this into the above. Can someone please advise.