[jQuery] JQuery + ASP .NET Issue
Hello all
I am new at JQuery. But, I have to say it is so kool to use. I try to
add the JQuery validate to my C# Page.
code as following:
I copy most of code from http://docs.jquery.com/Plugins/Validation/Methods/email#toptions
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language=javascript src=jquery.js></script>
<script language=javascript src=jquery.validate.js></script>
<script type="text/javascript">
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});;
</script>
<script>
$(document).ready(function(){
$("#form1").validate({
rules: {
TextBox1: {
required: true,
email: true
}
}
});
});
</script>
<style>#field { margin-left: .5em; float: left; }
#field, label { float: left; font-family: Arial, Helvetica, sans-
serif; font-size: small; }
br { clear: both; }
input { border: 1px solid black; margin-bottom: .5em; }
input.error { border: 1px solid red; }
label.error {
background: url('http://dev.jquery.com/view/trunk/plugins/validate/
demo/images/unchecked.gif') no-repeat;
padding-left: 16px;
margin-left: .3em;
}
label.valid {
background: url('http://dev.jquery.com/view/trunk/plugins/validate/
demo/images/checked.gif') no-repeat;
display: block;
width: 16px;
height: 16px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<label for="field">Required, email: </label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br/>
<asp:Button ID="Button1" runat="server"
onclick="Button1_Click" Text="Button" />
</div>
</form>
</body>
</html>
The problem is that even the input is valid, the form will not be
submitted! Does anyone know why?
Thank you much!