+ Post New Thread
Results 1 to 7 of 7
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 ...
  1. #1

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,037
    Thank Post
    209
    Thanked 425 Times in 306 Posts
    Rep Power
    143

    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.

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,374
    Thank Post
    625
    Thanked 951 Times in 653 Posts
    Blog Entries
    2
    Rep Power
    318

    Re: PHP input box question.

    You'll need to use some javascript events: I'd look into OnChange or Onkeyup.

  3. #3
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,790
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    117

    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.

  4. #4

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,037
    Thank Post
    209
    Thanked 425 Times in 306 Posts
    Rep Power
    143

    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.

  5. #5

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,582
    Thank Post
    107
    Thanked 761 Times in 592 Posts
    Rep Power
    179

    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.

  6. #6

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,374
    Thank Post
    625
    Thanked 951 Times in 653 Posts
    Blog Entries
    2
    Rep Power
    318

    Re: PHP input box question.

    To move to the next input box, use:

    Code:
    document.getElementById('input_id').focus();

  7. #7

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,037
    Thank Post
    209
    Thanked 425 Times in 306 Posts
    Rep Power
    143

    Re: PHP input box question.

    Quote 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:
+ Post New Thread

Similar Threads

  1. My Weather station cameras. More input please
    By Dos_Box in forum Wireless Networks
    Replies: 34
    Last Post: 7th January 2008, 02:32 PM
  2. turning off usb input peripherals
    By david12345 in forum Hardware
    Replies: 0
    Last Post: 26th November 2007, 09:45 PM
  3. Chinese character input - language bar woes
    By Ravening_Wolf in forum Windows
    Replies: 4
    Last Post: 2nd July 2007, 09:22 AM
  4. Compaq Evo T20 (CE v2) Input Device Problem
    By Ric_ in forum Thin Client and Virtual Machines
    Replies: 8
    Last Post: 13th November 2006, 11:03 AM
  5. Text WEP key for hex input
    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
  •