2

I'm looking to add an exposed filter that only contains existing user inputed value.

For example. I've create a content type called 'Items'. Inside that content type there is a field called 'Team name'. The user can freely enter the Team name and add multiple items associated with that Team.

When the user is viewing items, I'd like for them to be able to filter based on that Team Name, but rather than force them to type in the name, I'd like for the exposed filter to contain a list of Team Names that have been added into the nodes.

How to make an exposed filter that only contains existing database values?

  • Not sure of your cardinality. You have stated that one Team Name can be used on several Item nodes. Is it only one Team Name per Item node, or can one Item refer to more than one Team Name? – Triskelion Mar 3 '13 at 22:46
  • There can only be one team name per item node. But that team name can be associated with many items. – TheMad Hatter Mar 4 '13 at 3:20
0

It really sounds like the team name is a tag based on a Taxonomy Term. You could make a taxonomy called Teams and add a term_reference to your node type. Views can then make an exposed filter based on the term reference.

Using the autocomplete widget for the field will auto create non-existing team names. For more UI flexibility see Autocoplete Deluxe.

  • I'm unable to use the Taxonomy terms because the Team needs to have a bunch of other information that will be exposed in other forms. – TheMad Hatter Mar 4 '13 at 3:21
  • 2
    Taxonomies are Entities in D7 ... you could attach Fields onto the Team terms .... but if you feel you cannot do that, ok. – tenken Mar 4 '13 at 4:40
  • Could you explain further? I'm still a bit of a newb. The reason I feel I need to have Teams as a content type is because user's need to be able to apply for a team, and an admin needs to be able to see the application and accept/deny it. Is that all stuff I can do with Taxonomy? – TheMad Hatter Mar 4 '13 at 20:32
  • Well, I cant offer advice on how to build your whole project. You really need to look at all your requirements and then try to find a set of modules that mostly meet your needs. You will not be able to "accept/deny" raw taxonomy terms as I'm not aware of a Moderation module that works with Entities, only Nodes (like Workbench Moderation). – tenken Mar 4 '13 at 22:09
0

I think what you are looking for is the Views Selective Exposed Filters module, which limits the list of options to those returned as part of the data set.

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.