Results 1 to 4 of 4

Thread: Multiple Inputs Form Question

  1. #1
    Join Date
    Jul 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Multiple Inputs Form Question

    Hi I wanted to know how I might be able to apply this to multiple text boxes.

    For some reason it only lets me attach it to one on the page.

    Thank you

    Code:
    <html>
    <head>
    <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
    <title>sample page</title>
    <script type="text/javascript">
    //<![CDATA[
    function verify(frm)  {
    var element = document.getElementById('txt').value;
    element = element.replace(/[^0-9,\.]/,"");
    document.getElementById("txt").value = element;
    }
    //]]>
    </script>
    </head>
    <body>
    <form action=""><input type="text" onkeyup="verify(this.id);" name="txt" id="txt" /></form>
    </body>
    </html>
    Last edited by Snookerman; 04-22-2009 at 02:08 PM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Replace:
    Code:
    function verify(frm)  {
    var element = document.getElementById('txt').value;
    element = element.replace(/[^0-9,\.]/,"");
    document.getElementById("txt").value = element;
    }
    With:

    Code:
    function verify(frm)  {
    var element = document.getElementById(frm).value;
    element = element.replace(/[^0-9,\.]/,"");
    document.getElementById(frm).value = element;
    }
    Jeremy | jfein.net

  3. #3
    Join Date
    Jul 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's amazing, thanks so much!

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Glad to help you theflyingminstrel!

    It seems your topic is solved... Please set the status to resolved.. To do this:
    Go to your first post ->
    Edit your first post ->
    Click "Go Advanced" ->
    Then in the drop down next to the title, select "RESOLVED"
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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