Web Development Thread, PHP input box question. in Coding and Web Development; Hello,
I'm developing an assets management system at the moment that integrates into our helpdesk system so we can attach ...
-
26th July 2007, 02:09 PM #1 PHP input box question.
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.
-
-
IDG Tech News
-
26th July 2007, 02:11 PM #2 Re: PHP input box question.
You'll need to use some javascript events: I'd look into OnChange or Onkeyup.
-
-
26th July 2007, 04:57 PM #3 Re: PHP input box question.
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.
-
-
26th July 2007, 05:35 PM #4 Re: PHP input box question.
Cheers webman, pointed me in the right direction.
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;
Code:
<script language="JavaScript">
function disableEnterKey()
{
if (window.event.keyCode == 13) window.event.keyCode = 0;
}
</script> Then set your form up so it calls this function on every keypress by adding
'onKeyPress="disableEnterKey()' when you define your form.
e.g
Code:
<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.
-
-
26th July 2007, 07:51 PM #5 Re: PHP input box question.
@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.
-
-
26th July 2007, 08:58 PM #6 Re: PHP input box question.
To move to the next input box, use:
Code:
document.getElementById('input_id').focus();
-
-
27th July 2007, 11:15 AM #7 Re: PHP input box question.

Originally Posted by
Ric_ @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.
-
SHARE: 
Similar Threads
-
By Dos_Box in forum Wireless Networks
Replies: 34
Last Post: 7th January 2008, 02:32 PM
-
By david12345 in forum Hardware
Replies: 0
Last Post: 26th November 2007, 09:45 PM
-
By Ravening_Wolf in forum Windows
Replies: 4
Last Post: 2nd July 2007, 09:22 AM
-
By Ric_ in forum Thin Client and Virtual Machines
Replies: 8
Last Post: 13th November 2006, 11:03 AM
-
By NetworkGeezer in forum Wireless Networks
Replies: 2
Last Post: 16th March 2006, 07:16 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules