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. fire client alert script from submit button

fire client alert script from submit button

Scheduled Pinned Locked Moved ASP.NET
javascripttoolsquestion
5 Posts 5 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.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi, I need to validate a textbox, using javascript and an alert box. If the user clicks the submit button, and a value for a textbox is not filled in, I want to alert the user, and stop the submit process... if the value is filled in, the user can proceed with the submit process. How can I do this, and where can I read more about this type of validation.

    M T W W 4 Replies Last reply
    0
    • P playout

      Hi, I need to validate a textbox, using javascript and an alert box. If the user clicks the submit button, and a value for a textbox is not filled in, I want to alert the user, and stop the submit process... if the value is filled in, the user can proceed with the submit process. How can I do this, and where can I read more about this type of validation.

      M Offline
      M Offline
      MIHAI_MTZ
      wrote on last edited by
      #2

      You should use the "OnClientClick" property of the Submit button. Just use it to specify a javascript function. A requiredfield validator is also a good choice althoug it's not designed to show alert boxes. Mihai,

      1 Reply Last reply
      0
      • P playout

        Hi, I need to validate a textbox, using javascript and an alert box. If the user clicks the submit button, and a value for a textbox is not filled in, I want to alert the user, and stop the submit process... if the value is filled in, the user can proceed with the submit process. How can I do this, and where can I read more about this type of validation.

        T Offline
        T Offline
        Tuwing Sabado
        wrote on last edited by
        #3

        Use required field validator and validation summary. In order to show a popup message when validation failed. Use the code below or use the property window. eg. ValidationSummary1.DisplayMode = ValidationSummaryDisplayMode.BulletList; ValidationSummary1.ShowMessageBox = false; Regards, Mark

        1 Reply Last reply
        0
        • P playout

          Hi, I need to validate a textbox, using javascript and an alert box. If the user clicks the submit button, and a value for a textbox is not filled in, I want to alert the user, and stop the submit process... if the value is filled in, the user can proceed with the submit process. How can I do this, and where can I read more about this type of validation.

          W Offline
          W Offline
          www Developerof NET
          wrote on last edited by
          #4

          I would also prefer validation summary but if you want to show alert ,this is how u can In the form tag call a javascript function onSubmit.

          in script tag (in head) write the foll code function Validate() { var txt=document.getElementById("TextBox1").text; if(txt=="") { alert("Feild should not be empty"); return false; } else return true; } -- modified at 16:32 Tuesday 27th February, 2007

          1 Reply Last reply
          0
          • P playout

            Hi, I need to validate a textbox, using javascript and an alert box. If the user clicks the submit button, and a value for a textbox is not filled in, I want to alert the user, and stop the submit process... if the value is filled in, the user can proceed with the submit process. How can I do this, and where can I read more about this type of validation.

            W Offline
            W Offline
            wilf57
            wrote on last edited by
            #5

            try onClick="return confirm('Ready to submit');" or in ASP.Net onClientClick="return confirm('Ready to submit');" the return value influences the submit process: false stopps the submit if that works write a java script function (ex. Check), wich checks the textbox for empty and returns false if so and tie it to the onClientClick-event onClientClick="return check();"

            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