Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form>
- <input id=i1> <button id=b1>
- <input id=i2> <button id=b2>
- </form>
- $("#myform").validate().element("#i1");
- if ($('#myElem').valid()){
- // will also trigger unobtrusive validation only for this element if in place
- // add your extra logic here to execute only when element is valid
- }
- $('#myForm input:checkbox[name=yourChkBxName]').click(
- function(e){
- $("#myForm").valid();
- }
- )
- validator.checkForm()
- $(".setting-p input").bind("change", function () {
- //Seven.NetOps.validateSettings(Seven.NetOps.saveSettings);
- /*$.validator.unobtrusive.parse($('#saveForm'));*/
- $('#NodeZoomLevel').valid();
- $('#ZoomLevel').valid();
- $('#CenterLatitude').valid();
- $('#CenterLongitude').valid();
- $('#NodeIconSize').valid();
- $('#SaveDashboard').valid();
- $('#AutoRefresh').valid();
- });
- @using (Html.BeginForm("SaveSettings", "Settings", FormMethod.Post, new {id = "saveForm"}))
- {
- <div id="sevenRightBody">
- <div id="mapMenuitemPanel" class="setingsPanelStyle" style="display: block;">
- <div class="defaultpanelTitleStyle">Map Settings</div>
- Customize the map view upon initial navigation to the map view page.
- <p class="setting-p">@Html.LabelFor(x => x.NodeZoomLevel)</p>
- <p class="setting-p">@Html.EditorFor(x => x.NodeZoomLevel) @Html.ValidationMessageFor(x => x.NodeZoomLevel)</p>
- <p class="setting-p">@Html.LabelFor(x => x.ZoomLevel)</p>
- <p class="setting-p">@Html.EditorFor(x => x.ZoomLevel) @Html.ValidationMessageFor(x => x.ZoomLevel)</p>
- <p class="setting-p">@Html.LabelFor(x => x.CenterLatitude)</p>
- <p class="setting-p">@Html.EditorFor(x => x.CenterLatitude) @Html.ValidationMessageFor(x => x.CenterLatitude)</p>
- <p class="setting-p">@Html.LabelFor(x => x.CenterLongitude)</p>
- <p class="setting-p">@Html.EditorFor(x => x.CenterLongitude) @Html.ValidationMessageFor(x => x.CenterLongitude)</p>
- <p class="setting-p">@Html.LabelFor(x => x.NodeIconSize)</p>
- <p class="setting-p">@Html.SliderSelectFor(x => x.NodeIconSize) @Html.ValidationMessageFor(x => x.NodeIconSize)</p>
- </div>
- public class UserSetting : IEquatable<UserSetting>
- {
- [Required(ErrorMessage = "Missing Node Zoom Level.")]
- [Range(200, 10000000, ErrorMessage = "Node Zoom Level must be between {1} and {2}.")]
- [DefaultValue(100000)]
- [Display(Name = "Node Zoom Level")]
- public double NodeZoomLevel { get; set; }
- [Required(ErrorMessage = "Missing Zoom Level.")]
- [Range(200, 10000000, ErrorMessage = "Zoom Level must be between {1} and {2}.")]
- [DefaultValue(1000000)]
- [Display(Name = "Zoom Level")]
- public double ZoomLevel { get; set; }
- [Range(-90, 90, ErrorMessage = "Latitude degrees must be between {1} and {2}.")]
- [Required(ErrorMessage = "Missing Latitude.")]
- [DefaultValue(-200)]
- [Display(Name = "Latitude")]
- public double CenterLatitude { get; set; }
- [Range(-180, 180, ErrorMessage = "Longitude degrees must be between {1} and {2}.")]
- [Required(ErrorMessage = "Missing Longitude.")]
- [DefaultValue(-200)]
- [Display(Name = "Longitude")]
- public double CenterLongitude { get; set; }
- [Display(Name = "Save Dashboard")]
- public bool SaveDashboard { get; set; }
- .....
- }
- var validationManager = $('.myForm').validate(myParameters);
- ...
- validationManager.element($(this));
Add Comment
Please, Sign In to add comment