Log
Safari 2.0.3 and script.aculo.us’s Ajax.Autocompleter
Safari 2.0.3 breaks functionality that is essential to the use of script.aculo.us’s Ajax.Autocompleter class. When selecting an item from the generated list by pressing Return, the form is submitted.
I’ve searched far and wide for a fix for this and can’t seem to find one that works reliably for form submission. So here’s an ugly hack. Let’s say your autocompleting text field has an id auto_complete.
$ ('auto_complete').onkeypress = killIt;
function killIt (e)
{
if (typeof e != 'undefined' && e.keyCode == 13)
{
return false;
}
return true;
}
And that’s that.
04/05/06 11:46AM Ajax
Comments
Thanks, Rebecca! I’ve updated the script to reflect your input.
01/05/07 7:55PM
Add a Comment
Have something to say about what I wrote here? Let’s hear it!
- Your name and email address are required, but your email will not be displayed on the site
- If you provide a URL, a link to your site will appear
- You may use the following HTML:
<strong>bold</strong><em>italic</em><a href="http://url">links</a>
- Double line breaks will be converted to paragraphs.
- As you type, you should get a nice little preview of your comment directly below the text box.
- I reserve the right to edit any comment for any reason (I’ll be reasonable).
Recently Played on iTunes
-
“Heroin”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:26 -
“All Tomorrow's Parties”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:20 -
“Run Run Run”
The Velvet Underground & Nico
The Velvet Underground
11/17/08 16:16
Rebecca Younes:
Thanks for this solution. However, the code generates an error in IE6 because the keypress event is not defined for nonprinting function keys like Enter, Backspace, etc. So you have to expand the conditional to:
if (typeof e != “undefined” && e.keyCode == 13)
01/05/07 11:39AM