Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Thanked 0 Times in 0 Posts

    Removing First Character of a text box before submitting test box to database

    Im new to Javascript so I appologies now if this is a easy thing to resolve.

    I have a text box that a handheld scanner scans a barcode into. The problem is that the barcodes from the suppiler have an L at the start of the barcode.

    Is there a way to remove the first character of a textbox when its inserted into a database.

    Many Thanks

  • #2
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Orlando, FL
    Thanked 40 Times in 40 Posts
    Using the substring method for strings would probably be easiest. This is just an example as to how to use it. Not sure how you're submitting the data and such, so this is really just an example rather than the implentation you would like. However, using the server-side language that the form is being submitted to would probably be easier if you're just using the form to submit to the database.

    <script language="javascript">
    function fixInput()
    var myinput = document.myform.scaninput.value;
    document.myform.scaninput.value = myinput.substring(2,myinput.length);
    <form name="myform">
    <input type="text" name="scaninput" size="20" />
    <input type="button" name="submitinput" onClick="fixInput()" />


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts