Thanx Ken, The scan listening is working fine for my page. The scan value is gettin filled in the repective text fields. If its a card scan i have to process the scan output, filter and grab the card number, change the text field value and then submit the form. If its a barcode scan, i have change the text field value and submit the form.
Event.observe(document, "keydown", listenForScan.bindAsEventListener(document)); ---- will bring the corresponding field in focus. Event.observe(ccNumber, "change", formSubmit.bindAsEventListener(ccNumber)); Event.observe(ticketBarcode, "change", formSubmit.bindAsEventListener(ticketBarcode)); ----will submit the form after value change. As you can see in the code I am listening "change" event on the text fields. So after scanning, the field values will change (and i am using this change event to trigger formSubmit). the "listenForScan" and "formSubmit" should get triggered simultaneously without any user input. It works on firefox but not on IE6. I hope i was able to explain the issue clearly.... And again i really appreciate the help.... Vishal On Jul 5, 2:01 pm, Ken Snyder <[EMAIL PROTECTED]> wrote: > desiwave wrote: > > ... > > Event.observe(document, "keydown", > > listenForScan.bindAsEventListener(document)); > > ... > > Is there any way to implement this on IE6 ? > > I have implemented a BarcodeListener JavaScript class on a production > site. I discovered that globally detecting keypress on IE6 requires > that you observe _document.body_ instead of _document_ or _window_. So > I do: > > Event.observe( > Prototype.Browser.IE ? document.body : window, > 'keypress', > listenForScan.bindAsEventListener(document) > ); > > which fires for any keypress in IE6, IE7, FF2 > > If you have other problems with detecting barcodes in JS, I'd be happy > to share my BarcodeListener widget. > > Regards, > > Ken Snyder --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
