Xavier Noria wrote:
> If the user presses the return key on an autocompletion list to  
> select an item, the text field is updated just fine on Firefox and  
> IE, but it also triggers form submit on Safari. You normally don't  
> want that submit. Looks like in Safari the srcElement of the  
> onkeypress event is the text field itself, and see no way to  
> distinguish the return in the completion list from a return in the  
> text field (which is OK to submit the form).

The behavior of the enter with regard to form submissions is not a standard. The
different browsers try to behave in the same way, but they aren't quite there.

> A possible workaround to this is to intercept the return key  
> completely (and this prevent the user from submitting the form  
> pressing return in the text field), is there a better solution?

I've found out that enter only submits the form if there is an input of type
submit or image. So, you can change your submit into a button with an onclick
handler. This will fix your problem but will also make it so that enter won't
submit the form for other fields either.

To fix it for just that field you might have to change your local copy of
scriptaculous to do something different with Safari. If you get it working, then
definitely submit it back as a patch.

-- 
Michael Peters
Developer
Plus Three, LP


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to