Arun Kurmi

Arun Kurmi

  • NA
  • 104
  • 103.5k

validation using javascript in asp.net

Apr 28 2013 8:12 AM
hi friends,
How are you all ???
-----------------------
I have a assignment question-Perform validation by using javascript (without using validation tool from visual studio)
i take textbox for input and button for submit on webform.


i tried following but there are some error in this code-


<head runat="server">
<script language="javascript" type="text/javascript">
            function RequireFieldValidation()
        {
        var x=document.forms["testJavascript"]["TextBox1"].value;
        if(x=""||x==null)
        {
        alert("Please enter you name");
        return false;
        }
        }
    </script>
</head>
<body>
<form id="form1" runat="server" onsubmit="return RequireFieldValidation()">


<asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                        Text="Register"/>
</body>



Answers (1)