| Author |
Tab Event Without Tab key press
|
Jagadish Jain
Greenhorn
Joined: Apr 05, 2012
Posts: 8
|
|
Hello,
I'm developing a web application with JSPs and javascipts. I have a form with a textfield and a button, the textfield takes the input from the scanner. As soon as the scanner reads the input into this field, the cursor moves to the button below this textfield. When I tried scanning the barcode in wordpad, I noticed that there was a tab after the data that was read from the scanner. So, it seems this is the reason why the cursor is jumping to the button. I want to take advantage of this to cause an event to occur in javascript when ‘tab’ is encountered at the end of the data entry. If with be of great help for me if you can help me on how to trigger this event.
P.S: The tab key press event fails in the above scenario I mentioned.
Thanks,
Jagadish R Jain
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26200
|
|
|
What happens if you manually type data into the text field and press tab? Does it go to the button then? It should. If it doesn't can you post the relevant sections of HTML?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jagadish Jain
Greenhorn
Joined: Apr 05, 2012
Posts: 8
|
|
|
When I manually type data into text field and press tab the cursor jumps to the button.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
After the code is entered, does a onchange/blur/keyup/paste event fire?
Eric
|
 |
Jagadish Jain
Greenhorn
Joined: Apr 05, 2012
Posts: 8
|
|
|
The onchange event cannot be used as I am allowing the user to enter data manually too. The onblur event cannot be used because when the user clicks anywhere in the screen apart from textfield, the event will be fired. onkeyup and paste event too will not work.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Well you somehow have to figure out what event it is that can tell you it was not entered manually. After that you can figure out how to make it tab.
Eric
|
 |
Jagadish Jain
Greenhorn
Joined: Apr 05, 2012
Posts: 8
|
|
This is how I tried tackling this issue:
I wrote a logic in which an event is fired when the focus is on button. This event would insert a new textfield and would set the focus to the newly added textfield. This worked fine. Hopefully it will work fine in all scenarios.
Thank you for replying to this topic.
|
 |
 |
|
|
subject: Tab Event Without Tab key press
|
|
|