The challenge I’m trying to get ahead of here is a scaling problem. In that, the website I’m building is going to use a lot of Express Objects, and lead to many Express Entries, over time forms for many things will get to have very large amount of selections (selecting Express Entries through Associations).
So I am trying to find a way to apply a template to the core block the Express Form Block. I do not want to write my own block, as I want to leverage all the work already gone into the Express Form Block (input validation/sanitisation, etc). Also, hoping to do this WITHOUT Ajax.
Additionally I plan to re-use this method on many different Express Forms for many different purposes.
Let’s take a few Express Objects as part of the example for functional explanation:
- Events
- Tournaments
- Games
- Teams
Naturally, one event is likely to have multiple tournaments, and each tournament will associate with one game, and each tournament can have multiple teams. Over time, there will be multiple events, many more tournaments, many more teams, and the game size will roughly stay the same due to its reuse of that object entries.
Naturally, each event page will have an Express Entry attribute, which is set to the Express Entry that is the event itself.
First goal:
For the form, on the event page, where a user creates/joins a team for a tournament, I want to filter out any tournaments that are for OTHER events, and only show tournaments for THIS event. In the form the option to select would be the Express Association to the Tournaments Express Object, but how do I filter what is shown in the Form to only show Tournaments associated with this event?
Second goal:
There are going to be times where I have a form with multiple Express Associations in the form to select things from. In addition to the First goal, where I filter out based on an Express Entry (in previous example, the event). How do I make it so when I pick (single, or multiple) things from an earlier part of the same form, that filters what is possible to be selected in later Express Association selections in the same form?
Let’s say it’s a Form that is not on the event page, and you first pick which Event you want and then there’s a second selection for which Tournament you want (which is filtered based on which Event you just selected, so it ONLY shows Tournaments for that event), so that way you then can create a Team for that tournament.
==============================================
How can this be accomplished? @dimger84 proposed some ideas relating to Cascade Dropdowns however I really am nowhere near experienced enough to see how I can use that with Express Objects/Associations, relevant variables/objects, to connect the dots between that method and how the Express Form Block templating works.
Again, looking to do this without ajax, without writing my own block.
===============================================
The reason that this is important to me is that if I do not figure out a way to filter these things out, the forms for creating teams, registering for tournaments, and stuff like that, will become so bloated with previous events/tournaments/etc that they will be undesirable and painful to use. I want to solve this future problem now so that it never becomes a problem. And I think if a solution can be found for this, others would benefit from the method too.
Any help appreciated!