Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Hello,

 

I'm developing an assets management system at the moment that integrates into our helpdesk system so we can attach helpdesk tickets to particular assets etc. The system itsself is almost finished, but there's one thing I can't do.

 

I'm aiming to use a barcode scanner to scan in the serial numbers and asset numbers when adding assets to save time. The problem is the barcode scanner I have sends a return keystroke at the end of sending the data, which my PHP form interprets as submit. What I want to do is get the form to move to the next box if enter is pressed insted of submitting. Is this possible as I've not been able to achieve this.

 

My PHP and web design skills aren't great, I'm still really learning the basics, so any advice is appreciated.

 

Cheers,

 

Mike.

Posted

Not sure if this will work but try setting the form field for the barcode as a textfield rather than a straight text box and that may absorb the return.

 

If it does work you'll want to parse out the return character in the input but that's something for later.

Posted

Cheers webman, pointed me in the right direction. :D Not managed to get it to move onto the next box yet, but I've got it to ignore the enter keystroke.

 

For reference incase anyone else wants to do the same the following java function works a treat;

 

Define this function in your page;


 <br />
function disableEnterKey() <br />
{ <br />
   if (window.event.keyCode == 13) window.event.keyCode = 0;<br />
} <br />
 

 

Then set your form up so it calls this function on every keypress by adding

'onKeyPress="disableEnterKey()' when you define your form.

e.g

</pre><form method="POST" action="add.php" name="form1" enctype="multipart/form-data" onkeypress="disableEnterKey()">
<

 

My next challenge is to see if I can convert the enter keystroke into a tab, this is proving to be more dificult as it's not just a case of replacing the '0' with '9' as I hoped :(

 

Cheers,

 

Mike.

Posted
@maniac: You will usually find that you can 'program' the scanner using a code booklet (a book full of barcodes). You can change things like constant-scanning mode and character to send after after inputting the number.
Posted
@maniac: You will usually find that you can 'program' the scanner using a code booklet (a book full of barcodes). You can change things like constant-scanning mode and character to send after after inputting the number.

 

I already looked into this, but the scanner I'm using is very very old, I don't even know what make it is! All I know is it works and it's going to save me hours when I update the assets register at the end of this holiday!

 

@webman Thanks for that, I'll try it when I've got a chance to sit down and do some more work on the program.

 

Cheers,

 

Mike.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...