My data is straight forward. I have 3 models for managing vehicles.
Make (e.g. BMW)
Model (e.g 1 Series)
Vehicle (Variation) (e.g. spec name/derivative "120d Sport " and then all the spec data of the vehicle)
So the Model belongs to a Make. And the vehicle itself belongs to a Model and a Make.
In my create Vehicle form I have the 2 relation fields set up (Make & Model) which uses a drop down for the 1-Many relationship. I know I can hide the model drop down until a make is selected first, but at the moment every model in the database is displayed and selectable. I am struggling to work out how to get the list of models to update based on the selected make and return only models belonging to that make.
I've read through some docs and have previously used the getModelOptions method to populate a dropdown list. I think I can use the dependsOn trigger method even on relation fields, but unsure how to then use the filterFields or getModelOptions or a combination of both, in order to retrieve only models belonging to the selected Make.
All advice and pointers much appreciated. Thanks.
Last updated