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. how can chak

how can chak

Scheduled Pinned Locked Moved Web Development
7 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.
  • I Offline
    I Offline
    idsanjeevjha
    wrote on last edited by
    #1

    how can chak the input field is not empty when click on submit button

    sanjeev

    N 1 Reply Last reply
    0
    • I idsanjeevjha

      how can chak the input field is not empty when click on submit button

      sanjeev

      N Offline
      N Offline
      newc1
      wrote on last edited by
      #2

      Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.: <input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; } And also server-side by validationg the contents of the textbox.

      Clean code is the key to happiness.

      I N 2 Replies Last reply
      0
      • N newc1

        Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.: <input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; } And also server-side by validationg the contents of the textbox.

        Clean code is the key to happiness.

        I Offline
        I Offline
        idsanjeevjha
        wrote on last edited by
        #3

        Hi its work but after getting value also it return false

        sanjeev

        modified on Thursday, January 31, 2008 4:29:38 AM

        1 Reply Last reply
        0
        • N newc1

          Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.: <input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; } And also server-side by validationg the contents of the textbox.

          Clean code is the key to happiness.

          N Offline
          N Offline
          newc1
          wrote on last edited by
          #4

          Hi, If you took my code as was then you would need to change the type of the input control to submit, rather than button, as that will then cause a postback e.g. <input type='submit' value='Submit' onclick='return checkEntry();' />

          Clean code is the key to happiness.

          I 1 Reply Last reply
          0
          • N newc1

            Hi, If you took my code as was then you would need to change the type of the input control to submit, rather than button, as that will then cause a postback e.g. <input type='submit' value='Submit' onclick='return checkEntry();' />

            Clean code is the key to happiness.

            I Offline
            I Offline
            idsanjeevjha
            wrote on last edited by
            #5

            thanks it work fine but one thing i wants to add in it if length is 0 then alert massage also thanks again

            sanjeev

            N 1 Reply Last reply
            0
            • I idsanjeevjha

              thanks it work fine but one thing i wants to add in it if length is 0 then alert massage also thanks again

              sanjeev

              N Offline
              N Offline
              newc1
              wrote on last edited by
              #6

              Hi, Simply add an alert message after checking the value length: function checkEntry() { if (document.getElementById('textBox').value.length == 0) {   alert('Value is required');   return false; } return true; }

              Clean code is the key to happiness.

              I 1 Reply Last reply
              0
              • N newc1

                Hi, Simply add an alert message after checking the value length: function checkEntry() { if (document.getElementById('textBox').value.length == 0) {   alert('Value is required');   return false; } return true; }

                Clean code is the key to happiness.

                I Offline
                I Offline
                idsanjeevjha
                wrote on last edited by
                #7

                thanks Now woking fine Regrads

                sanjeev

                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