Hi
First, I would like to thank you for this module. It really helped me implement a proper search feature on my site.

However, there is a small problem. The views exposed search form block I have on my site is within a div for styling purpose. So, when you search something, although the search form disappears, the div box stays because the module adds display: none style to the form tag, but not the outer div.

How can I add the display:none to the whole div rather than just the form.
Forgive me if I am posting this in the wrong category, I am really new to drupal!

Thanks

CommentFileSizeAuthor
#4 acc exported view.txt17.84 KBfaizan_abid

Comments

haagendazs’s picture

Assigned: faizan_abid » haagendazs
Status: Active » Needs review

Hi faizan_abid: I committed some changes to the dev version of the module. Instead of hardcoding a "display:none" style to the block, I've added a jQuery script that adds a class to the block of an executed search view. The name of the class is "views-search-hide-exposed-block". This class should only be visible after you execute a search and should allow you to hide the complete block by adding "display:none" to your CSS file.

If you could test this and let me know if this works, that'd be great. Thanks!

faizan_abid’s picture

Hi,
Thanks for the reply.

I installed the dev version of the module but it did not add the class "views-search-hide-exposed-block". I found the code which you added in script, which is like:

**
 * Hide the exposed search result block on page load.
 */
$(document).ready(function(){
var exposedBlockId = Drupal.settings.views_search.exposed_form_block_id;
$('#' + exposedBlockId).addClass('views-search-hide-exposed-block');
});

I don't know the reason but it is not working. You could check it on the website www.lifeinsingapore.com.sg
Really sorry, for not being of any help to improve this module, but I am really new to all this.

haagendazs’s picture

Hi: I just checked out your site and verified that the jQuery script is added (which you can check by searching the source for "views_search_exposed_block.js", as well as the name of the block that contains the exposed form (which in your case is "block-views--exp-accommodation_search-page_1"). The script you quoted looks for this block and adds the class.

The problem in your case is that the ID of the block is not "block-views--exp-accommodation_search-page_1", but "block-views-41f7b391dbea7691c5b2592eea254a38" instead, and I don't really know why. Do you have some sort of Views caching activated?

The easiest way would be for you to export your complete view, so I can import it into a local Drupal install and test it.

faizan_abid’s picture

StatusFileSize
new17.84 KB

I don't have caching activated. For your info though, I cloned the view using another view and then made some modifications.

I have attached the exported code in a txt file.

Can I make some modifications to the script so it adds the class to the id of the block displayed on my page?
Thanks for your help!

haagendazs’s picture

Sorry for this late reply. I believe I found the reason why your block has a weird id (something like block-views-41f7b391dbea7691c5b2592eea254a38) and not a nicer one (such as block-views--exp-accommodation_search-page_1). Merlin answered this question in this post: http://drupal.org/node/388394#comment-1308606.

Basically: It's a limitation of Drupal. The easiest solution would be to rename your view to a shorter name, which would most likely fix this issue. You can do that by exporting the view, deleting the original view and re-importing it with a shorter name. Let me know if this fixes the issue (oh, you need to use the dev version of the Views Search module).