I am creating a simple mvc3 application.
the VIew is
<script>
function Submitform() {
var form = $('#frmAddStudent');
if (form) {
if (form.valid()) {
$(form).submit();
}
}
}
</script>
@using (Ajax.BeginForm("AddStudent", "Student", new AjaxOptions { HttpMethod = "POST" }, new { id = "frmAddStudent" }))
{
@Html.ValidationSummary(true)
<div class="editor-label">
@Html.LabelFor(model => model.StudentName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.StudentName)
@Html.ValidationMessageFor(model => model.StudentName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Address)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Address)
@Html.ValidationMessageFor(model => model.Address)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.DOB)
</div>
<div class="editor-field">
@Html.Telerik().DatePickerFor(model => model.DOB)
@Html.ValidationMessageFor(model => model.DOB)
</div>
<p>
<input type="button" value="Add" class="btn" onclick="return Submitform()" />
<input type="button" value="Cancel" class="close btn" onclick="closeDialog()" />
</p>
}
now the Problem is when i click on Submit button javascript function calls and it doesn't recognize "form.valid()" function.
it displays form.valid() TypeError: form.valid is not a function
so, whats the Problem in this .