I was wondering how you would apply the #ajax attribute to multiple form elements within the same scope of the video tutorial but dependent on one another and specifically query the database for those values instead of hardcoding them?
So as an example:
Lets say someone is selecting an ingredient for a recipe with fields like:
1.Food group category (food_group_table)
2. Ingredient name (ingredient_table)
3. Serving Size (ingredient_weight_table)
So for example someone selects from a dropdown the category of dairy > an ingredients dropdown is created based on those only for that category ie; milk, eggs, etc... > a serving size dropdown is displayed showing only serving sizes related to that ingredient ie; 1 cup, 1 ounce, 1 pound, etc...
Hope that makes sense. I guess i'm wondering if there is something special that would have to be done to check the form state of both 1 and 2 when displaying field 3 or is field 2 only necessary at that point?
I've seen similar questions in the drupal forums with no really good "how to" answers so a followup video to the ajax forms video utilizing this example would be awesome. Chris, if you could come up with something like this, i'd really like to see the code to query the database as well instead of just hardcoded arrays so the lesson learned is more real world and applicable. If anyone else has insight on how to accomplish this, i'd love to hear some feedback.
P.S. The site is awesome, much needed and worth every penny! I hope it continues to be successful for you... and us!