I need to create several jump menus on a site I'm working on and each needs to have a default entry that says "Select..." or something similar. Since Drupal menus require a valid path in each link I have thought to substitute a modified submission handler via hook_form_alter but I've been having issues because of the generation of multiple instances of the block. I've added a Drupal path to the front page of the site but don't really want the user to be accidentally redirected to the front page
Is there any consideration being given to adding a displayed default or enabling a configuration parameter which could intercept the firing of the first menu item and suppress the firing?
I really like the maintainability of using system menus and don't want to craft jump menus in HTML.
The folks doing the maintenance work may or may not be familiar with HTML.
Any thoughts/ assistance is appreciated
Ref - http://drupal.org/node/1454616
function *****_hacks_form_submit_alter($form, &$form_state, $form_id) {
if($form_id == "jump_quickly_form") {
$form['jump_quickly_form']['#submit'][0] = array('*****_hacks_jump_quickly_form_submit');
return $form;
}
}
/**
* REVISED Form submit callback for the jump form.
*
* @param array $form
* @param array $form_state
*/
function *****_hacks_jump_quickly_form_submit($form, &$form_state) {
if (!empty($form_state['values']['jump_goto'])) {
if ($form_state['values']['jump_goto'] = 'node/162') {
} else {
$fragment = explode('#', $form_state['values']['jump_goto']);
if (isset($fragment[1])) {
drupal_goto($fragment[0], NULL, $fragment[1]);
}
else {
drupal_goto($form_state['values']['jump_goto']);
}
}
}
}
Comments
Comment #1
deastlack commentedFound the Special menu items and installed it.
Switched my lead menu items from a reference to the front page to "".
Hit the go button ago got a 404 page not found
"The requested page "/%3Cnolink%3E" could not be found. "
Should I be using the option instead?
Since the desired behavior is that the go button should ignore the click on the dummy menu option it seems that the submit handler stills need to be modified to bypass the dummy menu item