I'm in the process of designing a web application and I'm thinking about incorporating some barcode reading to facilitate data input. Let's suppose I have a list of tasks a courier needs to do. I would like to print something similar to the following page:
+----------------------------------------------------------------------+
| Task List || || |||| || || ||| (a) |
| |
| Task One ||| || |||||| || ||| (b) |
| Task Two ||| || || | | || ||| (c) |
| Task Three | |||||| || ||| |||| (d) |
| |
| ||||| |||| || || ||| (e) |
+----------------------------------------------------------------------+
The barcodes are represented by the ||||| | ||| || (x)
at the end of every line. Printing the page should be straight forward using a barcode servlet as barbecue. I would like to have a general way to intercept those barcodes and do stuff in jQuery. For example:
- barcode (a) could be
goto:/tasklist/123:
- barcodes (b), (c) and (d) could be
add:31222:
,add:31223
, andadd:31224:
- barcode (e) could be
submit::
When scanning barcode(a) I would go to that page. When scanning barcodes (b), (c), (d) I would populate text inputs in the page. When scanning barcode (e) I would submit the form. I'm thinking of having some form of jQuery listener that is available on every page to which I can register actions based on the first command of the barcode. I know I can do programming of the barcode device to incorporate some of the logic, but would like to avoid it, so that any barcode would do and I don't have to deal with programming them.
I have even thought that each barcode might have to start with some magic token to distinguish between regular input and barcode input. Perhaps something like $**$:goto:/tasklist/123:
. The question is then how would I go about doing the jQuery to intercept this set of commands and what would be the correct way to register handlers for the different actions I create (e.g.: $**$:add:31222:
)?