i have used jquery validation engine in my project with correct references(source in masterpage). I have a page which inherits from master page and the form is;
<tr>
<td class="shade">
<asp:Literal runat="server" ID="LiteralSession" Text="Year" />
</td>
<td>
<asp:TextBox runat="server" ID="textBoxSession"
CssClass="validate[required]"
data-validation-placeholder="e.g 2012-2013" />
</td>
</tr>
<td style="height: 30px">
<asp:Button runat="server" ID="buttonRegister" Text="Register" ValidationGroup="R"
OnClick="Btn_Register_Click" />
</td>
In document.ready()
i am testing whether the validation engine has errors or not;
$(document).ready(function () {
$("#formMain").validationEngine('attach', { scroll: true });
$('#buttonRegister').click(function (evt) {
var isValid = $('#formMain').validationEngine('validate');
if (!isValid) {
alert("not valid");
evt.preventDefault();
}
else {
alert("valid");
}
});
});
However, when i post this form, it return true, when i don't type something in the textbox.
So, Why the jQuery Validation Engine
doesn't detecting the textBoxSession
for errors?
Update: I am also using update panel in my master page which wraps all the content placeholders including this (the above html codes)
action="submit.action"
attribute in<form id="formID" method="post" action="submit.action">
? – fapDaddy Apr 4 '13 at 9:35<form id="formMain" runat="server" method="post" action="submit.action">
– DotNet Dreamer Apr 4 '13 at 9:37$("#formMain")
to$('form')
works? Your form id might be changed by the html generator. – fapDaddy Apr 4 '13 at 9:47id="formMain"
– DotNet Dreamer Apr 4 '13 at 9:53