D
Daniel Smedegaard Buus
Hey
I'm trying to figure this one out, and it's a bit tricky.
I have a "tip a friend" form that's submitted via AJAX. When the user
presses enter inside one of the form's input fields, the form should
submit. This works out-of-the-box in FF and Safari, probably others
too, but not in IE6.
This is why I've used the "if(event.keyCode == 13) { try
{ event.cancelBubble = true; event.returnValue = false; } catch(e)
{}; }" trick to manually submit the form.
However, this introduces another problem: In FF, when I write in an
input field, I get a drop-down underneath with a list of previous
things I entered in similar input fields (I'm guessing input fields
with the same name tag). Now, if I pick one of these with my arrow
keys and then press enter to select it, not only is it selected, but
the form is also submitted, which is not the expected behavior
I'm wondering if there's any way to know if such a dropdown is open
and has focus so that I can prevent submitting the form when this is
the case? If any of you know, please tell me
Thanks in advance,
Daniel
I'm trying to figure this one out, and it's a bit tricky.
I have a "tip a friend" form that's submitted via AJAX. When the user
presses enter inside one of the form's input fields, the form should
submit. This works out-of-the-box in FF and Safari, probably others
too, but not in IE6.
This is why I've used the "if(event.keyCode == 13) { try
{ event.cancelBubble = true; event.returnValue = false; } catch(e)
{}; }" trick to manually submit the form.
However, this introduces another problem: In FF, when I write in an
input field, I get a drop-down underneath with a list of previous
things I entered in similar input fields (I'm guessing input fields
with the same name tag). Now, if I pick one of these with my arrow
keys and then press enter to select it, not only is it selected, but
the form is also submitted, which is not the expected behavior
I'm wondering if there's any way to know if such a dropdown is open
and has focus so that I can prevent submitting the form when this is
the case? If any of you know, please tell me
Thanks in advance,
Daniel