Re: AjaxObserveField and the Enter key
Re: AjaxObserveField and the Enter key
- Subject: Re: AjaxObserveField and the Enter key
- From: Ted Archibald <email@hidden>
- Date: Tue, 07 Feb 2012 15:49:54 -0600
I have some _javascript_ that I use to make a table of inputs act like an excel table (i.e. arrow keys, and enter acts like tab or down arrow). I'm pretty sure I've used with AjaxObserveField.
Here's the main part that intercepts the key event based on a class name in the table:
function onKeyEvent(e) {
var element = e.element();
var keyCode = e.keyCode;
if (!isException(element)) {
switch (keyCode) {
case Event.KEY_DOWN:
Event.stop(e);
cellDown(element);
break;
case Event.KEY_UP:
Event.stop(e);
cellUp(element);
break;
}
}
switch (keyCode) {
case Event.KEY_TAB:
Event.stop(e);
if (e.shiftKey) {
cellLeft(element);
} else {
cellRight(element);
}
break;
case Event.KEY_RETURN:
Event.stop(e);
if (e.shiftKey) {
cellUp(element);
} else {
cellDown(element);
}
break;
case Event.KEY_LEFT:
Event.stop(e);
cellLeft(element);
break;
case Event.KEY_RIGHT:
Event.stop(e);
cellRight(element);
break;
}
}
document.observe("dom:loaded", function() {
$$('.Navigatable').each(function(the_var) {
the_var.observe('keydown', onKeyEvent);
});
});
On Tue, Feb 7, 2012 at 11:07 AM, Pascal Robert
<email@hidden> wrote:
Hi guys,
I have a form with AjaxObserveField that are wrapping some check boxes and WOTextField. I was using the Tab key in the input field to call the action specified in the AjaxObserveField and it was working fine. But we did notice that it doesn't work when using the Enter (carriage return) in Safari on the first time. If I use the Tab key and I use the Enter key later, now it works.
Anyone knows a workaround?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden