Dr.Ajay Kashyap

Dr.Ajay Kashyap

  • NA
  • 521
  • 283.8k

JavaScript Validation For TextBox In Mvc

Feb 3 2017 7:17 AM
 I want validation For TextBox And TextBox  is List Type So How To Validate Using JavaScript.
The Following Validation I want :-
TextBox Should Not Be Empty
No Duplication  
 
Given Below Is My Code  
 
 
@model List
@using (Html.BeginForm("CreateCategory", "CategoryAndSubCategory", FormMethod.Post, new { enctype = "multipart/form-data", @id = "category" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.Label("Category Name", htmlAttributes: new { @class = "control-label col-md-2 required" })
@Html.EditorFor(a => a[j].Category, new { @class = "form-control", @placeholder = "Enter Category Name", @style = "text-transform: capitalize" })
@Html.ValidationMessageFor(a => a[j].Category, "", new { @class = "text-danger" })
}
}
 
 
 
<!-- Inject Script Filtered -->
 

Answers (3)