Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » FilteredDropdownSet - Simple Static Example Wanted

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 568 Views
  • markeaston
    Community Member
    11 Posts

    FilteredDropdownSet - Simple Static Example Wanted Link to this post


    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.


  • Stef87
    Community Member
    66 Posts

    Re: FilteredDropdownSet - Simple Static Example Wanted Link to this post

    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

    DataObject::get("Product", "Category = '" . $dropdown.val() . "'");

    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.

    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.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.