I have an exposed form (from a view) in a block. I'd like to make this block collapsible so that a user is presented with a search box and one other field and when a user types in the search box the form expands out to include the remainder of the form fields. I know I can use ctools_collapsible to make content collapsible but how do I extend this to any div/region?

  • ctools_collapsible uses a hard coded HTML fragment to generate its div. You might be able to pass like drupal_get_form('search_form'); to it to embed your search form in a collapsible div. Or, you could hook_form_alter the the search block and include the jqueryui form elements for D7 and wrap your search form in a collapisble div, there is already an example of this here on stackexchange, like drupal.stackexchange.com/questions/36387/… – tenken Apr 19 '13 at 1:36

If I understood you correctly: You have exposed filter in block, which have for example two fields, search by title and checkboxes.

So you can use: https://www.drupal.org/project/better_exposed_filters

  1. After installing module: change Exposed form style from Basic to Better Exposed Filters
  2. Click to BEF Settings
  3. Check Enable secondary exposed form options
  4. Expand yours fields what you need to hide before type in search box and check this: This is a secondary option
  5. Use jQuery:

        $(".views-widget-filter-secondary a").trigger('click');
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.