Views Selective Exposed should be able to convert text fields to select boxes based on the result set.

I've tried implementing this, and the result is the attached patch. It's far from perfect, though, since it probably has bugs and doesn't work with the active filter limit.

Files: 
CommentFileSizeAuthor
views-filters-selective-textfields.patch5.41 KBjowi

Comments

ErikWegner’s picture

Thanks jowi, I was looking for this feature, now sexy_exposed works with the title field.

ErikWegner’s picture

Jowi, do you think you could extend your patch so that the list of operators is not the list of string operators (begins with, contains all words, etc.) but is the the choice of "is in" and "is not in" like a filter for a select field? My view only contains around 20 nodes which are shown as flipped table. My intension is to have a list of these nodes' titles to select which 5 or 3 or any number of nodes to be shown and comparable.

Greetings,
Erik

roball’s picture

Component:Code» General

Wow jowi - this is a great start! Can confirm your patch brings the "Limit list to result set" checkbox also to text input fields :-)

However, once your patch is applied, all existing enabled "Limit list to result set" settings will no longer have any effect! Thus had to revert your patch.

Nevertheless, this would be an awesome magic improvement to Views!

roball’s picture

Component:General» Views Filters Selective
infojunkie’s picture

Status:Needs work» Needs review

I committed a fix to the latest dev that allows turning any filter to a select list based on the values in the result set. I am sure there will be many unhandled cases, but I'm just trying out the concept.

Please review (12 hours from now) and comment. Documenting edge cases and failures would be helpful.

roball’s picture

Status:Needs review» Needs work

Hm, does not work for me with the latest 6.x-1.x-dev (2010-Nov-14). In the 2010-Oct-29 dev it did, however!

infojunkie’s picture

Status:Needs work» Needs review

Thanks for your report. I found a regression introduced by a later commit. Please try it 12 hours from now and let me know.

roball’s picture

Status:Needs review» Reviewed & tested by the community

Yeah, working again :-)
One issue however: the options in the drop down menu do not seem to be ordered alphabetically. Please see https://www.iseki-food.net/drupal/view_picam_foodexp: The column "Keywords for scientific activities" originates from free unlimited text input fields. The exposed filter contains these key words in another order, but not alphabetically.

Thank you.

infojunkie’s picture

Status:Reviewed & tested by the community» Fixed

@roball: Thanks for the review. I also added code to sort the results.

roball’s picture

Thank you infojunkie! The new 2010-Nov-22 dev with the sorted option terms is great :-)

Status:Fixed» Closed (fixed)

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