0

I have a Page based on a View with an Exposed Filter which is the User ID. So the Search form that appears shows the User ID as the standard 'lookup' of users. I don't want that. I want to be able to have the search field be a standard text field and the results be a 'starts with'.

Eg.

Enter User: [Fra ]

Would return

Francis Frank Friend

How is this done?

1 Answer 1

1

If you use the "User: Name" filter it will give you an autocomplete text field where you can start typing and it will show you a list of patching users as you type.

That field will not let you enter partial user names though, you must select a user from the autocomplete (you can have multiple comma delimited values if you like).

To match partial user names, use the "User: Name (raw)" filter.

This one allows you to have a text field that doesn't have any validation. This field can have the operator set to "Starts with".

4
  • Thanks so much. One other thing: Is it possible to have the Exposed Filter created for the user in the -block- as opposed to the -page- display? I'd prefer to have a block that I can place within my own region. Or is that something one has to roll oneself?
    – jchwebdev
    Commented May 12, 2013 at 0:22
  • You can use exposed filters in a block view, but you need to enable ajax mode, which is in the advanced section on the right hand side of the view configuration. When you are using a block view, the exposed filters cannot use the exposed filters in a block option, they have to be in the same block as the view.
    – rooby
    Commented May 12, 2013 at 9:06
  • Got it. I've steered clear of the Ajax Mode because of a warning I saw on that option, which suggests restricting its use to 'sidebars'. I interpreted that to mean that it would not work well for a large number of records. Not so?
    – jchwebdev
    Commented May 13, 2013 at 16:51
  • The reason it has that warning is because if you use ajax then exposed filters are not actually shown in the url like they normally are, which means people cannot link to your view with soecific exposed filters, they can only link to the view with no exposed filters set. If this is not a problem for your use case then there is no problem.
    – rooby
    Commented May 14, 2013 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.