Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Required("Product name is required")]
- [StringLength(9, ErrorMessage="Must be under 9 characters")]
- public string product_name {get; set;}
- [Required("Descriptioon is required")]
- [StringLength(20, ErrorMessage="Must be under 20 characters")]
- public string Description {get; set;}
- [Required("Comment is required")]
- [StringLength(20, ErrorMessage="Must be under 50 characters")]
- public string Comment {get; set;}
- @using (Html.BeginForm("Register", "Product", FormMethod.Post, new { @id = "form-data" }))
- @Html.ValidationSummary(true, "", new { @class = "styled" })
- <div class="form-group">
- @Html.LabelFor(model => model.product_name)
- @Html.TextBoxFor(model => model.product_name, new { @class = "form-control", @placeholder = "Please enter here" })
- @Html.ValidationMessageFor(model => model.product_name, "", new { @class = "styled" })
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.Description)
- @Html.TextBoxFor(model => model.Description, new { @class = "form-control", @placeholder = "Please enter here" })
- @Html.ValidationMessageFor(model => model.Description, "", new { @class = "styled" })
- </div>
- <div class="form-group">
- @Html.LabelFor(model => model.Comment)
- @Html.TextBoxFor(model => model.Comment, new { @class = "form-control", @placeholder = "Please enter here" })
- @Html.ValidationMessageFor(model => model.Comment, "", new { @class = "styled" })
- </div>
- <button id="btnCreateAccount" type="submit" onclick="onCreateAccount()">Create Account</button>
- }
- @section Scripts {
- <script type="text/javascript">
- function onCreateAccount()
- {
- var elements = $("#form-data").data("validator").errorList;
- var fields =[]
- for (var i = 0; i < elements.length; i++) {
- fields = elements[i];
- }
- }
- </script>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement