Dear all, I hope that this question is appropriate for this list. I''m looking for a JavaScript solution to replace a Tab key with some other, like Enter key on a numeric keypad. Idea is to allow one hand entering of numerical data in a web form, which is currently not possible because a Tab key is on the other side of keyboard. As many of you probably know, accountants are doing number entry by one hand and they even don''t look at the solutions which use a tab key for jumping to another input field.Web based solutions are therefore no no for them, which I''d like to change. Any hint is appreciable, especially if it is done in a Prototype compatible way. Best regards Janko _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Dear all, I hope that this question is appropriate for this list. I''m looking for a JavaScript solution to replace a Tab key with some other, like Enter key on a numeric keypad. Idea is to allow one hand entering of numerical data in a web form, which is currently not possible because a Tab key is on the other side of keyboard. As many of you probably know, accountants are doing number entry by one hand and they even don''t look at the solutions which use a tab key for jumping to another input field.Web based solutions are therefore no no for them, which I''d like to change. Any hint is appreciable, especially if it is done in a Prototype compatible way. Best regards Janko --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
try this i have made an accountant application for entering CashFlow data table navigation with arrow keys and many more document.onkeypress = manageCashflowCellNavigation; ev=window.event; function manageCashflowCellNavigation(ev) { if (!ev) var ev = window.event if (ev.keyCode) code = ev.keyCode; else if (ev.which) code = ev.which; // alert(''You Pressed '' + code); switch (code) { case 40: // down arrow // do whatever javascript you whant break case 38: // up arrow // do whatever javascript you whant break case 37: // left arrow // do whatever javascript you whant break case 39: // right arrow // do whatever javascript you whant break case 97: // a case 97: // b case 99: // c case 100: // d case 101: // e case 102: // f case 103: // g case 104: // h case 105: // i case 106: // j case 107: // k case 108: // l case 109: // m case 110: // n case 111: // o case 112: // p case 113: // q case 114: // r case 115: // s //case 116: // t F5 case 117: // u case 118: // v case 119: // w case 120: // x case 121: // y case 122: // z case 945: // α case 946: // β case 947: // γ case 948: // δ case 949: // ε case 950: // ζ case 951: // η case 952: // θ case 953: // ι case 954: // κ case 955: // λ case 956: // μ case 957: // ν case 958: // ξ case 959: // ο case 960: // π case 961: // ρ case 962: // ς case 963: // σ case 964: // τ case 965: // υ case 966: // φ case 967: // χ case 968: // ψ case 969: // ω // do whatever javascript you whant return; break case 13: // ender key // do whatever javascript you whant return; case 27: // espcape // do whatever javascript you whant break default: // do whatever javascript you whant //return false; } } i am doing varius things there in each case navigation if you press numeric you add value if you press character you add description just like excel Nikos --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
here is a simple script, that lets you monitor selected input fields and assign TAB behaviour to ENTER key. (It''s written for prototype.js) <head> <title>Enter2Tab</title> <script type="text/javascript" src="cropper/lib/prototype.js"></script> <script> window.onload = function(){ // Observe keypress on these fields Event.observe($(''input1''), ''keypress'', enter2tab); Event.observe($(''input2''), ''keypress'', enter2tab); Event.observe($(''input3''), ''keypress'', enter2tab); Event.observe($(''input4''), ''keypress'', enter2tab); Event.observe($(''input5''), ''keypress'', enter2tab); } function enter2tab(eEvent){ if(eEvent.keyCode == Event.KEY_RETURN) { // an enter was pressed var node = Event.element(eEvent).nextSibling; while(node.tagName != "INPUT" && node.tagName != "SELECT" && node.tagName != "TEXTAREA") { // look for next input field node = node.nextSibling; } node.focus(); Event.stop(eEvent); } } </script> </head> <body> <input type="text" id="input1" /><br /> <input type="text" id="input2" /><br /> <textarea id="input3"></textarea><br /> <input type="text" id="input4" /><br /> <input type="text" id="input5" /><br /> </body> --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Hi Nikos, Thank you for your suggestion. Being weak in JavaScript I''m wondering what I''d write to replace "do whatever javascript you want" in your code to return tab instead to of Enter to a browser. Can I ask you to help me here too? Best regards Janko paranic wrote:> try this > i have made an accountant application for entering CashFlow data > table navigation with arrow keys and many more > > document.onkeypress = manageCashflowCellNavigation; > ev=window.event; > function manageCashflowCellNavigation(ev) > { > if (!ev) var ev = window.event > if (ev.keyCode) code = ev.keyCode; > else if (ev.which) code = ev.which; > > // alert(''You Pressed '' + code); > > switch (code) > { > case 40: // down arrow > // do whatever javascript you whant > break > case 38: // up arrow > // do whatever javascript you whant > break > case 37: // left arrow > // do whatever javascript you whant > break > case 39: // right arrow > // do whatever javascript you whant > break > case 97: // a > case 97: // b > case 99: // c > case 100: // d > case 101: // e > case 102: // f > case 103: // g > case 104: // h > case 105: // i > case 106: // j > case 107: // k > case 108: // l > case 109: // m > case 110: // n > case 111: // o > case 112: // p > case 113: // q > case 114: // r > case 115: // s > //case 116: // t F5 > case 117: // u > case 118: // v > case 119: // w > case 120: // x > case 121: // y > case 122: // z > case 945: // α > case 946: // β > case 947: // γ > case 948: // δ > case 949: // ε > case 950: // ζ > case 951: // η > case 952: // θ > case 953: // ι > case 954: // κ > case 955: // λ > case 956: // μ > case 957: // ν > case 958: // ξ > case 959: // ο > case 960: // π > case 961: // ρ > case 962: // ς > case 963: // σ > case 964: // τ > case 965: // υ > case 966: // φ > case 967: // χ > case 968: // ψ > case 969: // ω > // do whatever javascript you whant > return; > break > case 13: // ender key > // do whatever javascript you whant > return; > case 27: // espcape > // do whatever javascript you whant > break > default: > // do whatever javascript you whant > //return false; > } > } > > i am doing varius things there in each case > navigation > if you press numeric you add value > if you press character you add description > just like excel > > > Nikos >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---