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.

Customising the CMS /

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

How to dynamically populate dropdownfield2 in popup based on selection of dropdownfield1?

Go to End

5 Posts   1845 Views


Community Member, 7 Posts

17 December 2008 at 12:40am

Hi guys,

Apart from other fields, I have two dropdownfields in my Popup. I managed to get them populated with data. However, as there is a one-to-many relationship between them, I would like the second combo to be dynamically populated with the data specific to the first one. At the moment I get all the values in a second combo regardless of combo1. Is there a way to do it? And how can I find out if the state of the dropdownfield has been changed and how can I get the value?
I spent days on silverstripe doc, trying to find the answer but no luck.
Thank you in advance.


Community Member, 7 Posts

19 December 2008 at 12:20am

Hi guys,
Has anybody attempted to add conditional fields in Popup at all? I managed to update a textfield on the selection of dropdownfield, with the value from that dropdownfield in a tab of admin (used behaviour js file). But no luck with Popup.
Any thoughts guys?
Just let me know if it is possible. Otherwise I will let my boss know that it's not going to happen and we will look at alternatives.
Thanks so much.


Community Member, 712 Posts

19 December 2008 at 9:27am

At this stage I believe not.

This is a guess, but I think you can't load scripts from a popup, so you can't add the behaviour properly. You'd have to do something really hacky. My answer would be try it another way.


Community Member, 712 Posts

19 December 2008 at 9:29am

Which makes me think - do tree views work from popups? That would be a good way of handling it in a single field. Eg, say your two dropdowns where countries -> city, you could put them together in a single tree view:

+ New Zealand
---- Auckland
---- Christchurch
---- Hamilton
---- Wellington
+ Australia
---- Adelaide
---- Canberra

Andrew Houle

Community Member, 134 Posts

19 December 2008 at 9:58am

This is a feature that I've tried to add as well, but with no success. This is definitely something I'd like to be able to do. Maybe someone has gotten a hack to work, or maybe it's something that can be added in a later release?