7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » FilteredDropdownSet - Simple Static Example Wanted
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 386 Views |
-
FilteredDropdownSet - Simple Static Example Wanted

21 September 2012 at 6:58pm
Hi
I'm completely new to SilverStripe and need a very simple set of drop down fields in a hierarchy. From the sounds of things the FilteredDropDown set would be perfect but I don;t really need to put the values in a database.
Can someone please provide a brief example of how I would get it working for basic static data.
e.g. set up the first drop down with 'fruit' and 'vegetable' and the second with 'apple','pear','peach','carrot','potato' linking to the correct parent.
Thanks
-
Re: FilteredDropdownSet - Simple Static Example Wanted

18 October 2012 at 4:23am Last edited: 18 October 2012 4:24am
Hi Markeaston
Unfortunately one of your dropdowns will need to be populated with DataObjects from the database as the easiest way you can achieve this is by querying with
as this will retrieve all of the products with a category of fruit, for example, if that is what is selected in the other dropdown.DataObject::get("Product", "Category = '" . $dropdown.val() . "'");
I don't have time right now to write up the code but I'll be doing so in a few days if you can wait or if you can't, you use FilterDropDown as a jumping off point. You should be able to structure something in a similar way.
| 386 Views | ||
|
Page:
1
|
Go to Top |


