I have area with name "Admin". In that folder,I have page to create user. I put the validation. When I'm trying to add user, the validation is worked but I cannot submit the form. I pressed on the button no thing happen. If I remove the javascript form the view, I can add the user but without the validation.
I need help
"Admin Area"
============
In the control:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(string Mobile,string Password,string FirstName)
{
ParkingMvcApp.Models.Client client = new Models.Client();
client.Mobile = Mobile;
client.Role = "A";
client.Password = Password;
client.FirstName = FirstName;
client.CreatedDate = DateTime.Now;
//To check if the user already regitser
if (db.Clients.Any(m => m.Mobile == Mobile))
{
ModelState.AddModelError("Mobile", "The mobile already in use");
}
if (ModelState.IsValid)
{
db.Clients.Add(client);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(client);
}
In the view:
============
@model ParkingMvcApp.Models.ClientsMV
@{
ViewBag.Title = "Create";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script> -------------------->1
<script src="~/Scripts/jquery.validate.min.js"></script> ------------------>2
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>------->3
Create
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
}
@Html.ActionLink("Back to List", "Index")