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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to check If the Text box is Blank

How to check If the Text box is Blank

Scheduled Pinned Locked Moved ASP.NET
tutorial
5 Posts 4 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
    sabby2006
    wrote on last edited by
    #1

    How to check If the Text box is Blank or not on the client side. I have Two text boxes and one button on aspx page. on the click of button i want to check if the boxes are blank or not. It should be something on client side. thanks

    Regards

    N M A 3 Replies Last reply
    0
    • S sabby2006

      How to check If the Text box is Blank or not on the client side. I have Two text boxes and one button on aspx page. on the click of button i want to check if the boxes are blank or not. It should be something on client side. thanks

      Regards

      N Offline
      N Offline
      Nizha J
      wrote on last edited by
      #2

      why don't you use javascript validation function validateForm() {if(document.Form1.txt_username.value==""){ alert("Enter your User Name"); document.Form1.txt_username.value=""; document.Form1.txt_username.focus(); return false;} else return true; }

      Nizha

      S 1 Reply Last reply
      0
      • N Nizha J

        why don't you use javascript validation function validateForm() {if(document.Form1.txt_username.value==""){ alert("Enter your User Name"); document.Form1.txt_username.value=""; document.Form1.txt_username.focus(); return false;} else return true; }

        Nizha

        S Offline
        S Offline
        sabby2006
        wrote on last edited by
        #3

        i was doing the same but it does not recoganise my elements like form1.txtname is there any other way

        Regards

        1 Reply Last reply
        0
        • S sabby2006

          How to check If the Text box is Blank or not on the client side. I have Two text boxes and one button on aspx page. on the click of button i want to check if the boxes are blank or not. It should be something on client side. thanks

          Regards

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          RequiredFieldValidator[^]

          1 Reply Last reply
          0
          • S sabby2006

            How to check If the Text box is Blank or not on the client side. I have Two text boxes and one button on aspx page. on the click of button i want to check if the boxes are blank or not. It should be something on client side. thanks

            Regards

            A Offline
            A Offline
            Aashutoshkumar
            wrote on last edited by
            #5

            please try this on the click event of button if(Textbox1.Text=="") { .......... } Aashutosh kumar

            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