I wanna ask about scan card. Is there any way to disallow keyboard input and only allow scan card input to key in a field?
How about limit the time of input? I really have no idea.
Have a button (Scan Card)
Click the Scan Card button to have a popup window show up.
The popup window sets focus to a textbox with a width and height of 0px (setting display: hidden will throw security errors later)
Swipe the card
The input is put into the textbox
Create functions to parse the output that is put to the textbox (most cards have a predefined number of characters per line)
When the scan is complete (You will need to determine the condition at which you can say it is complete, x number of character per line) fill in the form in the parent window.
I have implemented this for a Canadian driver's license in an app. I am not allowed to share the code but can assure you it can be done.
Thanks a lot to stbuchok and Airshow. I tried using time as the limit and it works too. I use setTimeout() and set the time to 300milliseconds. When user keys in in more than 300milliseconds, the textbox is set to blank. It prevents user to key in manually.