Last updated 10 May 2010. Created on 10 May 2010.
Edited by udig. Log in to edit this page.

Say you need a drop down list composed of a view which functions as a navigation aid i.e. whenever an entry is selected (probably a node) the relevant page (of that node) is being loaded.
I was using this D5.x how to as the source. On top of that here's what I did:
1. Created a view called info_center_items. This view is using a 'fields' row style with single field included: the node title.
2. Created a module called jump_view and placed the below code inside:

function phptemplate_views_view_unformatted__info_center_items($view, $options, $rows, $title){

  $form = drupal_get_form('jump_view_form', $view, t('CHOOSE AN ITEM'));  

  return $form;  

function jump_view_form($form_state, $view, $initial_label){

  drupal_add_css(drupal_get_path('module', 'jump_view') .'/jump_view.css');
  // add the jQuery code which hides the 'Go' button and submits the form on change
  drupal_add_js ('
      $("#edit-nid-'.$view->name.'").change( function () {

  $options = array();
  $options[0] = $initial_label;
  foreach( $view->result as $node ) {
    $options[$node->nid] = _filter_url_trim($node->node_title, 35);  // Just to trim titles longer than 35 chars
  $form['#id'] = 'jumpmenu-'.$view->name; // give it a unique name, in case you want to have more than one on a page
  $form['#attributes'] = array('class' => 'jumpmenu-form', 'name' => 'jumpmenu-'.$view->name ); // again - for uniqueness and styling
  $form['nid-'.$view->name] = array(
    '#type' => 'select',
    '#options' => $options,
    '#id' => 'edit-nid-' . $view->name,
    '#class' => 'jumpmenu-item',
  $form['view_name'] = array( // again - allowing for multiples on a page
    '#type' => 'value',
    '#value' => $view->name,
  $form['submit'] = array( // the go button, which will be hidden via jQuery
    '#id' => 'edit-submit-jumpmenu-' . $view->name,
    '#attributes' =>  array('class' => 'edit-submit-jumpmenu'),
    '#type' => 'submit',
    '#value' => t('Go'),
  return $form;  

function jump_view_form_submit($form, &$form_state) {
  $form_values = $form_state['values'];
  if ( @$form_values['nid-'.$form_values['view_name']] && is_numeric($form_values['nid-'.$form_values['view_name']]) ) {

Looking for support? Visit the forums, or join #drupal-support in IRC.


ReeceMarsland’s picture

This works really well. Exactly the kind of nuggets I like to find.

Added to snippets.


ofktoubro’s picture

Or you can enable ctools ( and an extra "jump menu" option will "magically" and undocumentedly (?) appear in you views "Style" options. Choose that "Style" and select "Hide the 'Go' button" in the styles settings and well... that is it!

guysaban’s picture

Thanks for pointing this out - after a number of hours of looking for this function this really helped.

I also found the latest (11-July-2010) dev version of jump to provide similar functionality.

hixster’s picture

Can't see the jump style option in views? I'm using CTools 6.1.2?

Drupal Web Designers Surrey South East England

momendo’s picture

There is a patch for documentation using this Ctools feature.

#622740: Please document "jump menu"

Sjarsena’s picture

Do you know of any way to style this? Using css or would I have to modify the actual file to lets say change that drop down arrow button to a custom image. Cause I hid the Go button and I just want to change that default drop down arrow button to an image. any suggestions?

awasson’s picture

Subscribing... Nice!

Hadi Farnoud’s picture


سایت ساز
فروشگاه آنلاین
فروشگاه ساز کاموا سرویسی هست که میتوانید بدون نیاز به استخدام طراح، فروشگاه خود را بسازید

Pol’s picture

The module Better Jump Menu provides a Views Plugin Style to display JumpMenu from views.

Find me on Twitter