This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Chris_W
Chris_W

Hey all, after 3 days fighting to get this working I decided its time to reach out for some guidance.

I have a page (and will ultimately be multiple showing the same thing) where there are 3 cascading / linked / filtered dropdowns. Basically how Country, State, City drop downs work.

Name Company Agreement Addition Submit
Name1 Dropdown1 Dropdown2 Dropdown3 [submit]
Name2 Dropdown1 Dropdown2 Dropdown3 [submit]
Name3 Dropdown1 Dropdown2 Dropdown3 [submit]

These are all identical drop downs, I am not worried about filtering out ones that have been previously selected or anything fancy like that I just need to get it such that whatever Dropdown 1 is set to, will determine what Dropdown 2 shows. Once dropdown 2 is selected, it will determine what drop down 3 shows. I have a submit on each which I would really like to get rid of and have them just save on edit, but that didn't work either, but think I know why now I just haven't gotten around to that again.

Where I am getting stuck, is that doing this with just AJAX that I found, it will do this looking at the id/class but this will exist multiple times across the page. I looked to create this with PHP/MySQL, and from what I can find the best way is to have the ajax update a partial. I added all 3 to partials but I cant seam to get a partial to update another partial. Also since the Div will exist throughout the table I imagine running into the same issue mentioned before.

How to present the options for the 3 dropdowns is totally open, I can do this via the database or I can provide a JSON, I could generate YAML if need be. The data in this does change however, it is not static like Country, State and City. But I can push the update into file if needed via cron jobs or something.

If anyone could point me down a rabbit hole so I can finally figure this out and move on from this that would be super helpful

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.