Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Validation on Telephone No. in javascript

Validation on Telephone No. in javascript

Scheduled Pinned Locked Moved ASP.NET
javascript
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Suresh Pirsquare
    wrote on last edited by
    #1

    I am looking for a code in javascript which does not allow decimal values in the Telephone No. field(i.e textbox) Thanks & regards, Suresh Dayma

    Everything Is Possible!

    V 1 Reply Last reply
    0
    • S Suresh Pirsquare

      I am looking for a code in javascript which does not allow decimal values in the Telephone No. field(i.e textbox) Thanks & regards, Suresh Dayma

      Everything Is Possible!

      V Offline
      V Offline
      Vicky Roberts
      wrote on last edited by
      #2

      function KeyCheck(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (((keycode>47) && (keycode<58) ) || (keycode==8)) { return true; } else return false; } You can use this function for keypress so that it will not allow u to put any characters but only numeric. If you have a HTML control then call this function by onkeypress="return KeyCheck(this,event);" Else on server side code write TxtPhone.Attributes.Add("onkeypress","return KeyCheck(this,event)"); Vicky "Walking on water and developing Software on a specification is easy, if both are frozen..."

      S 1 Reply Last reply
      0
      • V Vicky Roberts

        function KeyCheck(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (((keycode>47) && (keycode<58) ) || (keycode==8)) { return true; } else return false; } You can use this function for keypress so that it will not allow u to put any characters but only numeric. If you have a HTML control then call this function by onkeypress="return KeyCheck(this,event);" Else on server side code write TxtPhone.Attributes.Add("onkeypress","return KeyCheck(this,event)"); Vicky "Walking on water and developing Software on a specification is easy, if both are frozen..."

        S Offline
        S Offline
        Suresh Pirsquare
        wrote on last edited by
        #3

        Thanks for your help.... Thanks & regards, Suresh Dayma

        Everything Is Possible!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups