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. Javascript for Space validation ?

Javascript for Space validation ?

Scheduled Pinned Locked Moved ASP.NET
javascriptquestionannouncement
5 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.
  • M Offline
    M Offline
    Masood Kochi SSF
    wrote on last edited by
    #1

    I use the below code for null checking.. if (document.getElementById("<%=txtHeading.ClientID%>").value=="") { alert("Enter News Heading"); } But when the user hit the space button , it become false.. So. Give me the code for chking One or more space through js ? Got ?Give..

    S N 2 Replies Last reply
    0
    • M Masood Kochi SSF

      I use the below code for null checking.. if (document.getElementById("<%=txtHeading.ClientID%>").value=="") { alert("Enter News Heading"); } But when the user hit the space button , it become false.. So. Give me the code for chking One or more space through js ? Got ?Give..

      S Offline
      S Offline
      Sherin Iranimose
      wrote on last edited by
      #2

      You must trim the string if (trim(document.getElementById("<%=txtHeading.ClientID%>").value)=="") { alert("Enter News Heading"); } function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); }

      EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

      M 1 Reply Last reply
      0
      • S Sherin Iranimose

        You must trim the string if (trim(document.getElementById("<%=txtHeading.ClientID%>").value)=="") { alert("Enter News Heading"); } function trim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); }

        EVEN THE WORD IMPOSSIBLE SAYS I M POSSIBLE.

        M Offline
        M Offline
        Masood Kochi SSF
        wrote on last edited by
        #3

        Thanks for ur solution

        1 Reply Last reply
        0
        • M Masood Kochi SSF

          I use the below code for null checking.. if (document.getElementById("<%=txtHeading.ClientID%>").value=="") { alert("Enter News Heading"); } But when the user hit the space button , it become false.. So. Give me the code for chking One or more space through js ? Got ?Give..

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Use a RequiredFieldValidator. It don't allow spaces.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          S 1 Reply Last reply
          0
          • N N a v a n e e t h

            Use a RequiredFieldValidator. It don't allow spaces.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

            S Offline
            S Offline
            Sherin Iranimose
            wrote on last edited by
            #5

            great :)

            EVEN THE WORD IMPOSSIBLE SAYS I M 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