Guest User

Untitled

a guest
Jan 3rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. <form>
  2. <input id=i1> <button id=b1>
  3. <input id=i2> <button id=b2>
  4. </form>
  5.  
  6. $("#myform").validate().element("#i1");
  7.  
  8. if ($('#myElem').valid()){
  9. // will also trigger unobtrusive validation only for this element if in place
  10. // add your extra logic here to execute only when element is valid
  11. }
  12.  
  13. $('#myForm input:checkbox[name=yourChkBxName]').click(
  14. function(e){
  15. $("#myForm").valid();
  16. }
  17. )
  18.  
  19. validator.checkForm()
  20.  
  21. $(".setting-p input").bind("change", function () {
  22. //Seven.NetOps.validateSettings(Seven.NetOps.saveSettings);
  23. /*$.validator.unobtrusive.parse($('#saveForm'));*/
  24. $('#NodeZoomLevel').valid();
  25. $('#ZoomLevel').valid();
  26. $('#CenterLatitude').valid();
  27. $('#CenterLongitude').valid();
  28. $('#NodeIconSize').valid();
  29. $('#SaveDashboard').valid();
  30. $('#AutoRefresh').valid();
  31. });
  32.  
  33. @using (Html.BeginForm("SaveSettings", "Settings", FormMethod.Post, new {id = "saveForm"}))
  34. {
  35. <div id="sevenRightBody">
  36. <div id="mapMenuitemPanel" class="setingsPanelStyle" style="display: block;">
  37. <div class="defaultpanelTitleStyle">Map Settings</div>
  38. Customize the map view upon initial navigation to the map view page.
  39. <p class="setting-p">@Html.LabelFor(x => x.NodeZoomLevel)</p>
  40. <p class="setting-p">@Html.EditorFor(x => x.NodeZoomLevel) @Html.ValidationMessageFor(x => x.NodeZoomLevel)</p>
  41. <p class="setting-p">@Html.LabelFor(x => x.ZoomLevel)</p>
  42. <p class="setting-p">@Html.EditorFor(x => x.ZoomLevel) @Html.ValidationMessageFor(x => x.ZoomLevel)</p>
  43. <p class="setting-p">@Html.LabelFor(x => x.CenterLatitude)</p>
  44. <p class="setting-p">@Html.EditorFor(x => x.CenterLatitude) @Html.ValidationMessageFor(x => x.CenterLatitude)</p>
  45. <p class="setting-p">@Html.LabelFor(x => x.CenterLongitude)</p>
  46. <p class="setting-p">@Html.EditorFor(x => x.CenterLongitude) @Html.ValidationMessageFor(x => x.CenterLongitude)</p>
  47. <p class="setting-p">@Html.LabelFor(x => x.NodeIconSize)</p>
  48. <p class="setting-p">@Html.SliderSelectFor(x => x.NodeIconSize) @Html.ValidationMessageFor(x => x.NodeIconSize)</p>
  49. </div>
  50.  
  51. public class UserSetting : IEquatable<UserSetting>
  52. {
  53. [Required(ErrorMessage = "Missing Node Zoom Level.")]
  54. [Range(200, 10000000, ErrorMessage = "Node Zoom Level must be between {1} and {2}.")]
  55. [DefaultValue(100000)]
  56. [Display(Name = "Node Zoom Level")]
  57. public double NodeZoomLevel { get; set; }
  58.  
  59. [Required(ErrorMessage = "Missing Zoom Level.")]
  60. [Range(200, 10000000, ErrorMessage = "Zoom Level must be between {1} and {2}.")]
  61. [DefaultValue(1000000)]
  62. [Display(Name = "Zoom Level")]
  63. public double ZoomLevel { get; set; }
  64.  
  65. [Range(-90, 90, ErrorMessage = "Latitude degrees must be between {1} and {2}.")]
  66. [Required(ErrorMessage = "Missing Latitude.")]
  67. [DefaultValue(-200)]
  68. [Display(Name = "Latitude")]
  69. public double CenterLatitude { get; set; }
  70.  
  71. [Range(-180, 180, ErrorMessage = "Longitude degrees must be between {1} and {2}.")]
  72. [Required(ErrorMessage = "Missing Longitude.")]
  73. [DefaultValue(-200)]
  74. [Display(Name = "Longitude")]
  75. public double CenterLongitude { get; set; }
  76.  
  77. [Display(Name = "Save Dashboard")]
  78. public bool SaveDashboard { get; set; }
  79. .....
  80. }
  81.  
  82. var validationManager = $('.myForm').validate(myParameters);
  83. ...
  84. validationManager.element($(this));
Add Comment
Please, Sign In to add comment