Change Drop down based on the selected value in another Drop down

0
I've an entity named 'Product' It has the following attributes: Name (String) Desc (String) price (Decimal) Quantity (Integer) Category (Enum) Subcategory (Enum) I've created a page where one can add new products. I want that if for example Category "furniture" is selected in the drop down that only subcategories of furniture get shown in the Subcategory drop down. I'm not sure how to accomplish this, but I do think that maybe I have to work with the OnChange event for the Category drop down.
asked
3 answers
3

You should replace your enum attributes for category and subcategory with two new entities to define these values. The subcategory should have an association with its parent category, then both entities are linked by associations to your product entity.

You can then constrain the values shown in the subcategory reference selector based on the value selected in the category reference selector using the constrained by property.

answered
2

Take a look at the documentation here: https://world.mendix.com/display/refguide6/Input%20reference%20set%20selector Read the part about constrained by.

Regards,

Ronald

answered
0

I am also trying to achieve the same result. I am really disappointed that it is so difficult to achieve what is basic basic functionality.

I have two tables Type and SubType

Type contains: Building Vehicle

Sub Type contains Building - House Building - Office Building - School Vehicle - Car Vehicle - Bike

I want two drop down lists

One to select the Type and then the other to be filtered on the selection of the Type.

I have read this page https://world.mendix.com/display/refguide6/Input%20reference%20set%20selector and I cannot make head nor tail how to achieve the expected result.The reference selector set option described in the example appears to want to load a new page to make the selection

I tried to set the data to come from an On Change micro flow - I cannot see how to pass in the selected value of the Type drop down. I have tried to constrain the values of the second drop down but the XPath is not straightforward and becomes unintelligible very quickly (and just generates errors)

I've spent 2 days researching this and cannot find how to do this - it shouldn't be this hard.

Can someone point me to a clearly worked example please.

answered