Jump without "Go" Button
Rob T - June 15, 2008 - 22:25
| Project: | Jump |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | marcp |
| Status: | needs review |
Description
I want the Jump to occur without the "Go" button.
What would be the best way to modify this module to allow for that ability?

#1
You probably should do this with a little bit of jQuery magic that hides the Go button and attaches whatever handler it is that deals with the enter key being pressed in a text field.
This functionality won't make it into Jump, so you'll need a separate javascript file that you either include in your theme or via some custom module.
#2
Thanks for the advice. It's definitely something I want to have.
I've been looking at this Views example, which utilizes that jQuery magic you mention to create a similar function (Drupal 5.x): http://drupal.org/node/186211
This might be a little heavy for me... especially if I want to have more than one Jump menu on a page... I'm sure I'll hack at it eventually. If anything promising develops, I'll post back.
BTW: it stinks that a "won't fix" assignment to the issue removes it from the queue. While I may or may not be able come up with a solution, I've found that quite often, solutions for little feature requests like this come about as a semi-collective community effort (ie. someone else sees the post, gives a hack at it, and posts back with their workaround or solution).
If feature request posts are hidden from public view, such a result is practically impossible.
#3
How about active (needs more info)?
Community - please post your solutions here. Never say never -- a nice solution, preferrably one that would be turned off by default and require an admin to turn it on, would have a good chance of getting in.
#4
Thanks for bringing the request back. Your general framework suggestion is solid, though I'd take a working template override as well.
#5
Any development on this question? If there is a solution to it I would like to know how its working.
Best regards
#6
I realize that this isn't what you're looking for, but I ended up making some old-school jump menus for my needs, placing similar code like this into a block (with my unfiltered HTML input format). I'd still love to have the menus automated via Drupal and Jump Menu, but the "Go" button seemed awkward for my needs.
<style language="text\css"><!--
.mainNavDropdown { font-size: .875em; width: 129; border: 1px solid #808080 }
-->
</style>
<table border="0" align="center" cellpadding="0" cellspacing="0">
<form method="post" name="sForm1">
<tr>
<td>
<select class="mainNavDropdown" name="dropdownbox" onchange="document.location=document.sForm1.dropdownbox[document.sForm1.dropdownbox.selectedIndex].value;">
<option value="">-- Menu Title --</option>
<option value="/page1">Page 1</option>
<option value="/page2">Page 2</option>
<option value="/page3">Page 3</option>
</select>
</td>
</tr>
</form>
</table>
#7
Yeah thats not exactly what I am looking for. I already implemented the needed function with a php-snippet, but its alway a hassle to set it up. I think the plugin without the go button would be a bit more handy. If you are intrested youll find the snippet (only for taxonomy) here: http://drupal.org/node/91924
#8
Thanks for that link. I'll have to try it out. In my case, I have Pathauto creating custom taxonomy paths, and then I have a 301 redirect in my htaccess file leading to my preferred landing spot for those taxonomy links. So I'm wondering how that snippet will function in my current setup.
I agree with you that this module with an option to scrap the go button would be sweet. I just haven't had the time to try a solution that incorporates the recommended jQuery magic that was suggested by marcp.
#9
Hey Guys...
Quickmenu module does this by default...(jumps without a button). It will work with any menu, which means to do taxonomy, you'd have to install taxonomy menu.module as well. I just did this setup on my latest site, and it worked like a charm.
Hope that helps.
#10
I think this would be a great thing to add, however, I do not believe in eliminating the current functionality since some people might have js disabled.
I wanted to try and add this functionality, so I borrowed the code from Rob T above and added it to the code of the module:
(line 51)
$form['#submit'] = array('jump_quickly_form_submit' => 1);$form['#theme'] = 'jump_quickly_form';
$form['#attributes']['class'] = 'jump-quickly';
$form['#attributes']['name'] = 'jumpquickly';
$form['jump_goto'] = array(
'#type' => 'select',
'#default_value' => '0',
'#options' => $options,
'#attributes'=> array('onchange' => "document.location=document.jumpquickly.jump_goto[document.jumpquickly.jump_goto.selectedIndex].value;")
);
I noticed that js didn't like "jump-quickly" as the name so I had to name it "jumpquickly". However, since I'm not a js guru, I'm not sure how you would pass in the form id number. I do think it's a good idea to allow more than one jump menu per page!
I dunno, there's probably a more elegant way to make this work.
Also, if you're using a relative path, it does some goofy stuff. For example if your link is "user/" . $user->uid and you're on a user page, the link you'll be directed to will be "user/user/uid".
#11
i do not know the module and didn't read everything here ...
but maybe this helps: http://drupal.org/node/313790
#12
@Rob_Feature #9
Hmm, maybe I'm doing something wrong...but I didn't get a select list with this module just a ul. Am I wrong to think you were referring to a standard form select list? Thanks Rob.
P.S. Your podcast rocks!
#13
I have started writing a patch that will be submitted tomorrow that will:
"This patch adds a configurable setting for adding a js file that will turn a jump module select list into a "javascripty" style jumper. If users have js disabled they will still the standard form. This patch depends on the patch from #344054: Jump blocks use delta for id w/ colon"
#14
This patch includes the patch for #344054: Jump blocks use delta for id w/ colon.
#15
This patch now requires hand massaging to apply against the new version of HEAD. Would you like me to re-roll this against HEAD after you commit #284985: Jump menu should default to showing the active page?
#16
Yeah, let's do these one at a time so that the commit messages will show clear messages for each issue. So, let's take care of #284985: Jump menu should default to showing the active page first and get it committed before re-rolling this one.
#17
subscribe
#18
This patch is against head. It includes a new test case to make sure that the js is included when configured to and not included when not configured to. The hook_uninstall has been updated to delete the variable that stores this configuration and some coder recommended fixes have been made to journal.test.
#19
After a quick look, I think the Javascript needs to target the form.jump-quickly since it's possible for the form to appear someplace other than in a block (for instance, it could appear in a View's header or footer if those are set to PHP and jump_quickly() is called from there).
#20
@marcp as per your suggestion the js now targets form.jump-quickly.
#21
@evoltech - thanks for the patch. I sent you some tweaks to get this working for items that are full URLs. This is still not working on IE and Safari, though.
#22
Don't believe the myth of cross platform compatibility with jQuery. I am sure anyone that has not used it is already skeptical, but I have had so much "luck" with it just working across different browsers that I stopped even testing other browsers.
The problem lied with IE and Safari not liking to bind click handlers on option elements. I fixed this by watching the whole jump-quickly form for a 'change' event then pulling out the selected option.
Good call with looking for offsite urls, I didn't even think of that case. I took it a bit furthur and changed the logic to check for any link with a :// prefix.
I updated the test cases to reflect the location and new name of the js file.
#23
@evoltech - I haven't tried it yet, but from looking at the patch the
drupal_add_js()looks like it might need to be moved. I'm pretty sure it belongs at the beginning ofjump_quickly_form()so that it makes it in there even when thejump_quickly()API call is made from some custom code in another module or a view header/footer, or custom block, etc.#24
oops, I incorrectly copied that section of code from the patch you gave me. Re-rolled.
#25
Thanks, evoltech - I'm looking this over. If anyone else in this thread is interested, please try out the patch in #24. One thing that will change before it gets committed is the line in jump.js that says:
window.location.replace(dest);will say:
window.location = dest;I played with the replace for a while and didn't like the way I couldn't use my browser's back button. So far I've tested on IE, Safari, FF on Windows and FF on Mac.
#26
I confirmed that the JS change you made in #25 works in FF. Just noticed though that if an off site link is the top menu, not selected, is clicked that it doesn't work. I am not seeing an obvious solution to this right off the bat. I was able to get this to work correctly with native js (like in this example). But then there is the issue of getting all of the id's that the jump-quickly form uses, easy with jQuery, but there seems to be problems mixing jQuery selectors and native js selectors. I also tried binding other events to the select element wiith varying results, none really satisfactory. I am at a bit of a standstill.
#27
subscribe