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 prob...@macti.ca 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 (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/ted.archibald%40gmail.com
This email sent to ted.archib...@gmail.com
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com