This topic is locked

Barcode Scanning into fields of phprunner

5/12/2016 7:07:05 PM
PHPRunner General questions
F
fullfusion author

Hi Sergey,
On this post: http://www.asprunner.com/forums/topic/20413-barcode-scanning-into-field/pageviewfindpostp68969
You recommended to use this code:



$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});


I am trying to make it work with the existing function in the List page, Add page, Edit page by modifying Javascript onLoad event. This is what it looks like in version 8.1

function OnPageLoad(pageObj,pageid,proxy,inlineRow)

$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});
// Place event code here.

// Use "Add Action" button to add code snippets.

} // function OnPageLoad

{


I know that post was old; what do i need to do to make it work? we want to be able to scan a serial# and have it update and go to the next field to add another. My scanner is set to act as a keyboard and carriage return.
The database i am trying to populate has only two fields, an Int as an ID (auto increment) and the Serial# field as a varchar(50) which come from a barcode.
Can you please help! I am really green.... Thank you in advance!

A
aalekizoglou 5/13/2016



Hi Sergey,
On this post: http://www.asprunner...dpostp68969
You recommended to use this code:



$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});


I am trying to make it work with the existing function in the List page, Add page, Edit page by modifying Javascript onload event. This is what it looks like in version 8.1

function OnPageLoad(pageObj,pageid,proxy,inlineRow)

$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});
// Place event code here.

// Use "Add Action" button to add code snippets.

} // function OnPageLoad

{


I know that post was old; what do i need to do to make it work? we want to be able to scan a serial# and have it update and go to the next field to add another. My scanner is set to act as a keyboard and carriage return.
The database i am trying to populate has only two fields, an Int as an ID (auto increment) and the Serial# field as a varchar(50) which come from a barcode.
Can you please help! I am really green.... Thank you in advance!


Just to help I have done a lot of barcode scanning web applications and have developed a javascript framework, to work with. The main idea is:

  1. set the barcode to send a prefix and offset. I usually put ~ for prefix and <CR> for suffix
  2. user jquery to override keyboard events on browser
  3. have the barcode Framework (javascript) to control keyboard events. If prefix is pressed and within a configurable timeout check if other keys are pressed and if suffix if pressed. If so then this is a valid barcode, and will send it back to my specified field.
    My framework consists of a barcodelistener.js and a php function to generate a valid input field. The solution has is working on various browsers (chrome, firefox, IE, tablets, and android phones) and is generally based on http://stackoverflow.com/questions/11290898/detect-when-input-box-filled-by-keyboard-and-when-by-barcode-scanner/15354814#15354814

F
fullfusion author 5/13/2016



Just to help I have done a lot of barcode scanning web applications and have developed a javascript framework, to work with. The main idea is:

  1. set the barcode to send a prefix and offset. I usually put ~ for prefix and <CR> for suffix
  2. user jquery to override keyboard events on browser
  3. have the barcode Framework (javascript) to control keyboard events. If prefix is pressed and within a configurable timeout check if other keys are pressed and if suffix if pressed. If so then this is a valid barcode, and will send it back to my specified field.
    My framework consists of a barcodelistener.js and a php function to generate a valid input field. The solution has is working on various browsers (chrome, firefox, IE, tablets, and android phones) and is generally based on http://stackoverflow.com/questions/11290898/detect-when-input-box-filled-by-keyboard-and-when-by-barcode-scanner/15354814#15354814


Thank you so much! As i mentioned before; i am really green....
How do i go about applying this to PHPRunner 8? I need detail instructions. Thank you in advance!!!

F
fullfusion author 5/13/2016

I just noticed with the following code in the Javascript onload event of Add pages it works on the PC via a keyboard when i click enter. It saves the record.
But with the barcode scanner it does not work in PHPrunner 8(scanner is programmed to Carriage Return)
Just to prove the scanner is working; i tested it by scanning into a notes doc in iPad and it works correctly.

$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});


Any ideas, what could be missing?

A
aalekizoglou 5/24/2016



I just noticed with the following code in the Javascript onload event of Add pages it works on the PC via a keyboard when i click enter. It saves the record.
But with the barcode scanner it does not work in PHPrunner 8(scanner is programmed to Carriage Return)
Just to prove the scanner is working; i tested it by scanning into a notes doc in iPad and it works correctly.

$(document).keyup(function(e) {

if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});


Any ideas, what could be missing?


Why not debug with some javascript coding
just change that to

$(document).keyup(function(e) {
alert(e.keyCode);
if (e.keyCode == 13)

{

$("#saveButton1").trigger('click');

}

});


to see what the barcode sends to you. You should also add e.preventDefault(); when you want to stop the event to continue to the default handler.