To amliorate my application i have activeted the Client Side Validation and it works so fine, but unfortuly Some Jquery Form Validation has turned down and dosn’t work any more 🙁
This is my JS code:
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.core.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ui.widget.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("form").validate({
rules: {
idv: { required: true },
dd: { required: true },
df: { required: true },
remise: { required: true }
}
});
});
</script>
And this is my Form code :
<% using (Html.BeginForm("Promo", "Agence", FormMethod.Post, new { @class = "search_form" })) { %>
<p>
Matricule vehicule : <br />
<%: Html.TextBox("idv")%> <br />
De : <br />
<%: Html.TextBox("dd")%> <br />
Juqu'a : <br />
<%: Html.TextBox("df")%> <br />
Remise : <br />
<%: Html.TextBox("remise") %> % <br />
Description : <br />
<%: Html.TextArea("des", new {rows="4", cols="30" })%>
</p>
<input type="submit" value="Ajouter" class="button"/>
<% } %>
In this form i dont need to use model, i’m using other model in this same page, The Jquery Validation was working so fine until i have activated The Validation Client side.
Verify that these two lines are in your web.config file in the
appSettingssectionAnd add this line to your layout
Also modify your existing scripts so that they all use
src="@Url.Content("~/Scripts/...