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. javascript to validate textbox

javascript to validate textbox

Scheduled Pinned Locked Moved Web Development
javajavascripttutorialquestion
6 Posts 3 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.
  • K Offline
    K Offline
    kishorg1
    wrote on last edited by
    #1

    i have text box in datagrig. i want to accept only string characters in text box. how to write java scripte for tht?

    M 1 Reply Last reply
    0
    • K kishorg1

      i have text box in datagrig. i want to accept only string characters in text box. how to write java scripte for tht?

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      Use the onkeypress event. Call a javascript function on this event which chekcs the key code. If this do not want this character return blur()

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      K 1 Reply Last reply
      0
      • M Manas Bhardwaj

        Use the onkeypress event. Call a javascript function on this event which chekcs the key code. If this do not want this character return blur()

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        K Offline
        K Offline
        kishorg1
        wrote on last edited by
        #3

        on click of button i want to validate text box for string means user must have to enter only string textbox name is comment so how i will validate i try to write but thts not working function check() { debugger; var s1=document.getElementById("TextBox1"); var s=s1.value; if(IsNumeric(s)) { alert("Numeric characters are not allowed"); } } not support IsNumeric function

        M 1 Reply Last reply
        0
        • K kishorg1

          on click of button i want to validate text box for string means user must have to enter only string textbox name is comment so how i will validate i try to write but thts not working function check() { debugger; var s1=document.getElementById("TextBox1"); var s=s1.value; if(IsNumeric(s)) { alert("Numeric characters are not allowed"); } } not support IsNumeric function

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          Use regular expression to validate your input string

          Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          K 1 Reply Last reply
          0
          • M Manas Bhardwaj

            Use regular expression to validate your input string

            Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

            K Offline
            K Offline
            kishorg1
            wrote on last edited by
            #5

            i want to display alert........with tht i ant show tht if plz sen me tht code of javascript for tht textbox

            L 1 Reply Last reply
            0
            • K kishorg1

              i want to display alert........with tht i ant show tht if plz sen me tht code of javascript for tht textbox

              L Offline
              L Offline
              Learning IT
              wrote on last edited by
              #6

              u can use javascript alert on .cs //---------------javaScript Alert------------------------- public void CreateMessageAlert(System.Web.UI.Page senderpage, string alertMsg) { string alertKey = "alertKey"; string strScript; strScript = "alert('" + alertMsg + "')"; if (!senderpage.IsStartupScriptRegistered(alertKey)) { senderpage.RegisterStartupScript(alertKey, strScript); } } //-------------------------------------------------------- call it like - s = "hello"; CreateMessageAlert(this, s);

              Maniiiiiiiiiiiiiii

              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