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.

Data Model Questions /

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

Dependent Values from many_many in dropdown


Go to End


1111 Views

Avatar
Lexandclo

Community Member, 55 Posts

2 March 2016 at 3:17am

HI
I have a a many_many relationship between

/Service.php
private static $many_many = array(
'Location' => 'Location',
	
);

and

/Location.php
private static $belongs_many_many = array(
'Service' => 'Service',
	
);

so there are lots of Locations with many Services on.

I have a drop down in a form which displays all Locations


new DropdownField( 'Locations ', 'Locations ' ,$locations->map('ID','Title')

what i would like is to display the Services underneath the dropdown in Checkboxes so people can select multiple services etc

So what they select a Location the relevant services display underneath.

Any Ideas would be greatly received

Many Thanks

Darren