Questions tagged [unobtrusive-validation]

Unobtrusive Validation refers to a jQuery plugin created by Microsoft used in conjunction with the jQuery Validate plugin. It is shipped with ASP.NET MVC 3.

Unobtrusive Validation is a jQuery plugin written by Microsoft that acts as a support library for jQuery and the jQuery Validate plugin.

The script is shipped as part of ASP.NET MVC 3 and is included in new Visual Studio 2010 MVC 3 projects by default. It uses HTML5 data attributes (data-val-*) usually originating from DataAnnotation attributes on the view's model.

1239 questions
0
votes
1 answer

RequiredAttribute doesn't appear on client-side validation, on derived class

My viewmodel inherits from a class that inherits from an abstract class that has a property with a [Required] attribute, but the rule doesn't appear in the DOM and unobtrusive validation doesn't catch the error. The display attribute goes through…
Madd0g
  • 3,841
  • 5
  • 37
  • 59
0
votes
1 answer

MVC3 unobtrusive validation - how can I see validation failed if the inputs are off the screen?

I have a wizard in MVC3 that scrolls through multiple pages before reaching a confirmation page with a submit button. My problem is, when there is a validation failure in one of the previous pages of the wizard, the issue is not visible when…
0
votes
1 answer

Is it possible to reuse jquery picker control when validation got errors?

I use datetime picker for ASP.NET MVC with razor, when submitted form got validation error message, it would not keep my entered values nor the picker not work anymore. Is it possible to reuse picker control after validation error happened?. My…
San
  • 1,104
  • 3
  • 17
  • 31
0
votes
1 answer

When use IEnumerable in view client side validation is not working?

I am passing List from Model to view , so I specified in view like this IEnumerable. In this situation Client side validation is not firing View : @model IEnumerable @{ ViewBag.Title = "Display"; }
Sham
  • 1,191
  • 2
  • 13
  • 25
0
votes
1 answer

Trigger jQuery animation when css class gets changed by unobtrusive validation

What I am trying to do is to fade in validation summary slowly when errors found. I am using ASP.NET MVC 4 with unobtrusive jQuery validation. Validation works well. When issues are found css class of the summary div switches from…
0
votes
2 answers

MVC3 unobtrusive validators not being written into partial page

When the following code is retrieved via an ajax call no validators are written into the view. Any number of these partial views might be added to the page and the textbox gets a datepicker, so that's why the unique id is generated. I certainly…
Keith Myers
  • 1,379
  • 2
  • 15
  • 29
0
votes
1 answer

Parse attributes from MvcHtmlString

I need to be able to parse the attributes from an MvcHtmlString (the results of an HtmlHelper extension), so that I can update and add to them. For example, take this HTML element:
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
0
votes
1 answer

How can I client validate with a mask in MVC3, but model validate without?

I normally store phone numbers as 10 digits in the database. However, I want to use a jQuery masked input plugin to guide the user with a mask like this: (_) -___. Unfortunately, my StringLength attribute fails as well as my \d{10} regex attribute…
Jason Butera
  • 2,376
  • 3
  • 29
  • 46
0
votes
1 answer

jquery unobtrusive validation non working for dynamically loaded content in form

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% Html.EnableClientValidation(); %> <% using (Html.BeginForm("HelpRequest", "Form", FormMethod.Post, new {id ="formTrim"…
0
votes
1 answer

Date Fails Client and Server Side Validation Using ASP.NET MVC 3 Data Annotations

In all my projects, I have jQuery date pickers that format the date dd-MMM-yyyy which both users worldwide and the DateTime.parse method understand perfectly - sadly this does not appear to be the case for data annotation validation! I have my data…
Jimbo
  • 22,379
  • 42
  • 117
  • 159
0
votes
2 answers

Why unobtrusive MVC validations are not working in IE7 and IE8?

I have an application in ASP.NET MVC 3 using Razor. I have setup some data annotations on text boxes along with jQuery validation and unobtrusive validation. The thing is, some fields have custom validation logic using plain old vanilla JavaScript…
Rohit416
  • 3,416
  • 3
  • 24
  • 41
0
votes
2 answers

Prevent user from submitting default form values in .NET MVC3

I have the following model: public class Contact { public Contact() { Name = "Your Name"; Email = "Your Email"; Message = "Your Message"; } [Required] [StringLength(60,MinimumLength = 3)] public…
Nick Brown
  • 1,167
  • 1
  • 21
  • 38
0
votes
1 answer

DropDownListFor Unobtrusive validation shows on empty form

I get validation message always when I open this page (even first time), even if I choose value in one of dropdown lists, message doesn't go away. If I choose values in both I can submit form but messages still doesn't go away. Snippet is Linq to…
formatc
  • 4,261
  • 7
  • 43
  • 81
0
votes
1 answer

MVC unobtrusive validation only being applied to one nested model

I have a form made up of nested models as below: foreach (var item in Model) {

@item.StageDescription

Lyno
  • 16
  • 1
0
votes
1 answer

Unobtrusive validation works on one controller but not another

I have two different views belonging to two different controllers. A view the first controller works fine with unobtrusive validation. The 2nd view does not. It seems like validation plugin is not running because $.validator.unobtrusive is…
Alex
  • 9,250
  • 11
  • 70
  • 81