This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Tab Event Without Tab key press Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Tab Event Without Tab key press" Watch "Tab Event Without Tab key press" New topic
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
    
  66

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
    
    6
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
    
    6
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Tab Event Without Tab key press
 
Similar Threads
JTable behaviour
JTextArea size changes on pressing TAB key
tabbing in JTable
showing cursor in textBox
JTable and tab order.