www.webdeveloper.com
Results 1 to 7 of 7

Thread: Using barcode input data to textbox and move to second textbox the focus

  1. #1
    Join Date
    Oct 2011
    Posts
    349

    Using barcode input data to textbox and move to second textbox the focus

    Hi..

    I have form and i want to input data using barcode and it will display on textbox and after input on the first textbox the focus will go to next textbox untill it will go on the last textbox and on the last textbox it will automatically save the data's on the database.

    How is it possible?

    here is my sample code:

    Code:
    <?php
        error_reporting(0);
       date_default_timezone_set("Asia/Singapore"); //set the time zone  
    $con = mysql_connect('localhost', 'root','');
    
    if (!$con) {
        echo 'failed';
        die();
    }
    mysql_select_db("mes", $con);
    ?>
    
    <html>
    <head>
    <script type="text/javascript">
    function ini()
    {
    
    // Retrieve the code
    var code =document.getElementById ("code_read_box1").value;
    var code =document.getElementById ("code_read_box2").value;
    var code =document.getElementById ("code_read_box3").value;
    var code =document.getElementById ("code_read_box4").value;
    var code =document.getElementById ("code_read_box5").value;
    var code =document.getElementById ("code_read_box6").value;
    // Return false to prevent the form to submit
    return false;
    
    }
    
    </script>
    </head>
    <body onLoad="document.barcode.code_read_box1.focus()">
    
    <form name=barcode onsubmit = "return ini()">
    
    <input type="text" id="code_read_box1" value="" /><br/>
    <input type="text" id="code_read_box2" value="" /><br/>
    <input type="text" id="code_read_box3" value="" /><br/>
    <input type="text" id="code_read_box4" value="" /><br/>
    <input type="text" id="code_read_box5" value="" /><br/>
    <input type="text" id="code_read_box6" value="" /><br/>
    </form>
    
    </body>
    </html>

  2. #2
    Join Date
    Nov 2011
    Posts
    64
    Where is the submit button ?

  3. #3
    Join Date
    Oct 2011
    Posts
    349
    No submit button...I mean on the last textbox it will save the inputted data.

    Thank you

  4. #4
    Join Date
    Aug 2013
    Posts
    2
    What kind of barcode generator are you using? Is it possible that it is the problem of the barcode generator? You may choose another barcode generator to have a try.

  5. #5
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,636
    this
    Code:
    var code =document.getElementById ("code_read_box1").value;
    var code =document.getElementById ("code_read_box2").value;
    var code =document.getElementById ("code_read_box3").value;
    var code =document.getElementById ("code_read_box4").value;
    var code =document.getElementById ("code_read_box5").value;
    var code =document.getElementById ("code_read_box6").value;
    is equal to:

    Code:
    var code =document.getElementById ("code_read_box6").value;
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  6. #6
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,645
    Code:
    document.getElementById ("code_read_box6").value;
    no sp[ace between Id and (
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  7. #7
    Join Date
    Aug 2013
    Posts
    24
    Quote Originally Posted by fifthes32 View Post
    What kind of barcode generator are you using? Is it possible that it is the problem of the barcode generator? You may choose another barcode generator to have a try.
    maybe or maybe not

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
  •  
HTML5 Development Center



Recent Articles