0

I have a View which display the title field of content of the type Partners. However, I want to format the results in a drop-down select list, so when a user selects one of the titles, it will automatically redirect the user to the content page. How can I achieve this?

2
  • 1
    I think this is possible but not with Views. If I had to, I'd do that programmatically with a query to populate a select in a form... – Djouuuuh Oct 29 '14 at 10:12
  • 1
    It can be done by manipulating the views templates, in particular the 'Style output' and 'Row style output' templates. You must set the value attribute on the option to the url and will have to get javascript to listen to the onchange event and do the redirect. And you will most probably have to use the $row variable in the template, so remember to sanitize as it is print unsafe. – J. Reynolds Oct 29 '14 at 13:30
3

Sure this is all possible:

  1. If you just want a select list assure you have the Ctools module installed on your site and use the Jump Menu views style output for your Partners content type. Alternatively use the Jump Menu module which you may find more helpful.

  2. Want this embedded into a block you say? Use the Views Field View module to place your output of (1) into a second view that is a block. If you go this route you likely want to enable caching in your Views.

Be sure to see the project page(s) for these modules.

0

That is very conditionnal, select is mean to be into a form element... If you wanted a block without a form, then a custom block would definitly be the best flexible solution as @j_reynolds suggest.

Anyway in views, you can create "form". When creating a page, just expose one of your filter criteria to user. And magic it create a form. It more look like a search page, not really what you asked.

But maybe you could consider to create a view that list all the teaser of your partner and add exposed filter on the name/title ?

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.