By pinxi on
I am trying to filter my view by a computed field. My main issue is that the computed field only offers these operators:
- Is Greater Than
- Is Greater Than Or Equals
- Is Equal To
- Is Not Equal To
- Is Less Than Or Equals
- Is Less Than
and then a text field. I am looking to make the text field a drop down. I have been able to do this by creating a block using the following code and displaying on the corresponding view:
<form id="views-filters-block" method="get" action="http://localhost/acedesigns.com/capablitites/framing/mouldings/blacks">
<div class="form-item-0">
<select id="edit-filter0" class="form-select" name="filter0"><option value="**ALL**">-all-</option><option value="black">black</option><option value="silver">silver</option><option value="gold">gold</option><option value="brown">brown</option><option value="white">white</option><option value="other">other</option></select>
</div>
<div class="form-item1">
<select id="edit-filter0" class="form-select" name="filter1"><option value="**ALL**">-all-</option><option value="yes">yes</option><option value="no">no</option><option value="maybe">maybe</option></select>
</div>
<div class="form-submit">
<input type="submit" class="form-submit" value="Submit" id="edit-submit"/>
</div></form>
I then hide the regular filter created by the view with:
/* This is a hack to remove the filter table above each view. NOTE: This removes ALL view filters!!*/
form#views-filters{
display:none;
}
I would like to:
- how do I make the selected option change?
- is there a prettier way to do this?
thanks!
Comments
...
Yes. Starting with Views 1.6 you can implement
hook_views_tables_alter, in a custom module, to alter the definitions of filters. E.g.:(I assumed the name of the field is "Color".)
A very detailed explanation of all the members in a filter array can be found here (especialy "part 5" and "part 2").
Getting Closer
It would have helped if I posted the original code:
This is the way that the current filters print. I want to remove them from the page, move them to a side block and display them in divs.
I found this from Merlin and it works perfectly to remove the filters from the page: (added to template.php)
However, when I add the accompanying code to display the filters in a block. My site breaks (I think it is for Drupal 4.7):
The main issue is that this is all a little over my head, but I am learning!
Thanks
help hook_views_tables_alter
I installed the filter block module and then added this code to my template:
This gave me the filters in the side block in div's without collapse/uncollapsed (like I want). Now, I just need to figure out how to change the text field inputs into drop downs.
I am trying to do something like this to no avail:
Were you able to figure this
Were you able to figure this out?
Example
Here is an example of what I am trying to do:
http://ace.pinxi.net/capabilities/framing/mouldings
subscribing
subscribing
http://SocialNicheGuru.com
Delivering inSITE(TM), we empower you to deliver the right product and the right message to the right NICHE at the right time across all product, marketing, and sales channels.
Subscribing.
Subscribing.
subscribing
subscribing