diff --git a/includes/jump-menu.inc b/includes/jump-menu.inc index df358e8..086eb98 100644 --- a/includes/jump-menu.inc +++ b/includes/jump-menu.inc @@ -117,5 +117,15 @@ function ctools_jump_menu($form_state, $select, $options = array()) { * This is normally only invoked upon submit without javascript enabled. */ function ctools_jump_menu_submit($form, &$form_state) { - $form_state['redirect'] = $form_state['values']['jump']; + // If the path we are redirecting to contains the string :: then treat the + // the string after the double colon as the path to redirect to. + // This allows duplicate paths to be used in jump menus for multiple options. + $redirect_array = explode('::', $form_state['values']['jump']); + + if (isset($redirect_array[1]) && !empty($redirect_array[1])) { + $redirect = $redirect_array[1]; + } + else { + $redirect = $form_state['values']['jump']; + } } diff --git a/js/jump-menu.js b/js/jump-menu.js index 85aba3e..c27c248 100644 --- a/js/jump-menu.js +++ b/js/jump-menu.js @@ -10,7 +10,11 @@ .addClass('ctools-jump-menu-processed') .change(function() { var loc = $(this).val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; @@ -24,11 +28,15 @@ // Find our sibling value. var $select = $(this).parents('form').find('.ctools-jump-menu-select'); var loc = $select.val(); - if (loc) { + var urlArray = loc.split('::'); + if (urlArray[1]) { + location.href = urlArray[1]; + } + else { location.href = loc; } return false; }); }; -})(jQuery); \ No newline at end of file +})(jQuery);