Hi,
I have two exposed filters : region and sub-region.
I want to hide the sub-regions until the user selects a region.
I also want to update the available sub-regions according to the selected region.
I have been able to hide the exposed filter thanks to Views Exposed Filters.
I am able to update the available sub-regions according to the selected region thanks to some custom code using the "#ajax" attribute of the Drupal Ajax Forms API.
However, I cannot make them work both at the same time. Both behavior - the hiding and the update - work the first time, but then only the hiding works and my custom update does not trigger anymore.
Any idea why and/or how I could deal with that?
Comments
Comment #1
Nicolas Bouteille CreditAttribution: Nicolas Bouteille commentedStill haven't found why there was a conflict and how I could solve it, but in the mean time decided to hide / show the sub-regions manually using jquery in order to move on.
Here's my code if anyone needs it someday:
Comment #2
InternetDevels CreditAttribution: InternetDevels commentedAre You sure that used wrapper id in #ajax wasn't changed in html after first ajax call? Drupal uses drupal_thml_id() function to prevent id duplicates on the page after ajax call. Sometimes it can change id used in 'wrapper' ajax property. Can You please post an example of your code?
Comment #3
Nicolas Bouteille CreditAttribution: Nicolas Bouteille commentedHi,
Yes I am pretty sure the id did not change, that's one of the things I checked because it had already happened to me once.
My code is documented here http://bouteillenicolas.com/expertise-drupal/views-ajax-dynamic-dependen...
But you know, now that I implemented my own code above I am not going to use Views Exposed Filters anymore. Plus, I might actually use Simple Hierarchy Select in the end, which does both the filling and the hiding. Right now a bug in Views regarding the Content : has taxonomy terms (with depth) functionality is preventing me from using it http://drupal.org/node/1961368
But that's definitely where I am heading so I don't want you to waste some time on this current issue.
Thanks for the help anyway!
Comment #4
swim CreditAttribution: swim commentedSorry for bumping this issue,
We faced a similar problem with manipulating exposed filters from a form_id_alter. The way around this was simple but required a little digging.
Wouldn't it be more appropriate for views to provide it's own hook for exposed forms? Always keeping the correct/ relevant $form['#id']?
Comment #4.0
swim CreditAttribution: swim commentedto two