I was theming my exposed filters, and couldn't style each individual exposed filter because the divs had a class of views-exposed-widget but no unique identifier. it WAS like this (note no id in the div):

<div class="views-exposed-widget">
                  <label for="edit-uid">
            Name          </label>
                        <div class="views-widget"> ...

So I edited views-exposed-form.tpl.php in my modules/views/theme to look like this:

<div class="views-exposed-widget" id="<?php print $widget->id; ?>">

and now my html source looks like this (note the id in the div):

<div id="edit-uid" class="views-exposed-widget">
                  <label for="edit-uid">
            Name          </label>
                        <div class="views-widget"> ...

and edited my theme css to look like this:


#edit-uid.views-exposed-widget {
	clear:both;
	float:none;
	}

where edit-uid is the unique identifier for the exposed filter I'm trying to style.

Did I do the right thing? Is there a better/easier way around this? I don't like hacking files in modules because i will need to rehack when I update the module no?

Comments

davidbessler’s picture

Darn. Now the field doesn't autocomplete. Anyone have a solution for me?

davidbessler’s picture

OK. So, clearly, I'm the kind of guy who doesn't read directions before I do something. I found this:

http://drupal.org/node/190815

clearly explaining the concept of overriding .tpl.php files. So, ignore that whole part.

I still need help figuring out how to get the autocomplete to work on my field again.

dawehner’s picture

What happens if you remove this css code? i guess this could be the reason.

davidbessler’s picture

I got it to work. I was using the same ID as other things, and CSS needs IDs to be unique. So I had the IDs come out as style-edit-uid instead of edit-uid which was being used for the labels. Now it works fine. Thanks.

dawehner’s picture

Status: Active » Fixed

Ah fine.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

squarecandy’s picture

Thanks for the reminder that views-exposed-form.tpl.php exists.

I used id="exposed-widget-<?php print $id; ?>" instead of id="exposed-widget-<?php print $widget->id; ?>" - some things like the date module were not providing a value for $widget->id.