Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. [Required("Product name is required")]
  2. [StringLength(9, ErrorMessage="Must be under 9 characters")]
  3. public string product_name {get; set;}
  4.  
  5. [Required("Descriptioon is required")]
  6. [StringLength(20, ErrorMessage="Must be under 20 characters")]
  7. public string Description {get; set;}
  8.  
  9. [Required("Comment is required")]
  10. [StringLength(20, ErrorMessage="Must be under 50 characters")]
  11. public string Comment {get; set;}
  12.  
  13.  
  14. @using (Html.BeginForm("Register", "Product", FormMethod.Post, new { @id = "form-data" }))
  15.  
  16. @Html.ValidationSummary(true, "", new { @class = "styled" })
  17.  
  18. <div class="form-group">
  19. @Html.LabelFor(model => model.product_name)
  20. @Html.TextBoxFor(model => model.product_name, new { @class = "form-control", @placeholder = "Please enter here" })
  21. @Html.ValidationMessageFor(model => model.product_name, "", new { @class = "styled" })
  22.  
  23. </div>
  24.  
  25. <div class="form-group">
  26. @Html.LabelFor(model => model.Description)
  27. @Html.TextBoxFor(model => model.Description, new { @class = "form-control", @placeholder = "Please enter here" })
  28. @Html.ValidationMessageFor(model => model.Description, "", new { @class = "styled" })
  29.  
  30. </div>
  31.  
  32. <div class="form-group">
  33. @Html.LabelFor(model => model.Comment)
  34. @Html.TextBoxFor(model => model.Comment, new { @class = "form-control", @placeholder = "Please enter here" })
  35. @Html.ValidationMessageFor(model => model.Comment, "", new { @class = "styled" })
  36.  
  37. </div>
  38. <button id="btnCreateAccount" type="submit" onclick="onCreateAccount()">Create Account</button>
  39. }
  40.  
  41.  
  42.  
  43. @section Scripts {
  44. <script type="text/javascript">
  45.  
  46.  
  47. function onCreateAccount()
  48. {
  49. var elements = $("#form-data").data("validator").errorList;
  50. var fields =[]
  51. for (var i = 0; i < elements.length; i++) {
  52. fields = elements[i];
  53. }
  54. }
  55. </script>
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement