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. java script validation

java script validation

Scheduled Pinned Locked Moved ASP.NET
javajavascripttools
3 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.
  • S Offline
    S Offline
    shakti das
    wrote on last edited by
    #1

    i am having a text box and a button.i want to validate that textbox using javascript.when i click on the submit button one alert message will come that textbox must be filled out and if i am entering some value to that textbox it will show what value i have entered in that alert message.i want a sample code for this.

    U E 2 Replies Last reply
    0
    • S shakti das

      i am having a text box and a button.i want to validate that textbox using javascript.when i click on the submit button one alert message will come that textbox must be filled out and if i am entering some value to that textbox it will show what value i have entered in that alert message.i want a sample code for this.

      U Offline
      U Offline
      ujju 1
      wrote on last edited by
      #2

      Try This

      <script type="text/javascript">
      function jsTest()
      {
      if (document.getElementById("<%=txtBox1.ClientID%>").value == "") {
      alert("Please Select a Pay From Option");
      document.getElementById("<%=txtBox1.ClientID%>").focus();
      return false;
      }
      else {
      alert(document.getElementById("<%=txtBox1.ClientID%>").value);
      }
      }

      1 Reply Last reply
      0
      • S shakti das

        i am having a text box and a button.i want to validate that textbox using javascript.when i click on the submit button one alert message will come that textbox must be filled out and if i am entering some value to that textbox it will show what value i have entered in that alert message.i want a sample code for this.

        E Offline
        E Offline
        Elham M
        wrote on last edited by
        #3

        It's as easy as drink water call below function

        function Confirm() {
        return confirm("Are U sure to delete this file؟");
        }
        </pre>
        <pre lang="c#">
        <asp:Button ID="BtnDelete" runat="server" Text="delete" Width="95" OnClientClick="if (!Confirm()) return false;" UseSubmitBehavior="False"/></pre></x-turndown>

        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