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
2 answers

How to get unobtrusive validation on my JQueryUI element, (Combobox)?

In ASP NET MVC, I had an @Html.DropDownList in which the validation for the field was working just fine. As I needed the field to be editable I decided to use the JQueryUI Combobox, but right now I'm not getting the unobtrusive validation until I…
Laggel
  • 1,356
  • 3
  • 19
  • 36
0
votes
1 answer

jQuery Validation 1.10 and MVC server-side errors

This feature used to work just fine on my website. If I added a custom error to ModelState, the input on the page would be marked as "input-validation-error" and the Html.ValidationMessage() would take care of rendering a span with the error…
sam360
  • 1,121
  • 3
  • 18
  • 37
0
votes
3 answers

Validate image upload unobtrusively using Jquery validate for dynamic forms?

I've got an image upload that is created on a dynamic form. I am trying to make it so that I can validate that the file uploaded is an actual image, and do this unobtrusively. I've read about the .rules() settings and using the accept property, but…
SventoryMang
  • 10,275
  • 15
  • 70
  • 113
0
votes
0 answers

An MVC helper for a validated AJAX form dialog loaded from another page?

I have a simple edit form. For a particular field, if the user doesn't see what they want, they can click a link, and a request form will pop-up in a new window. (FYI, we support mobile browsers.) If jQueryUI is available, progressive enhancement…
shannon
  • 8,664
  • 5
  • 44
  • 74
0
votes
1 answer

Newly added Form Elements doesn't get binded for client side validation in MVC 3

I have AJAX Form in MVC 3. In Index view:
<% Html.RenderPartial("ContactForm", Model); %>
AJAX form on ContactForm Partial View <% using (Ajax.BeginForm("Contact", new AjaxOptions() { UpdateTargetId =…
jNet
  • 153
  • 1
  • 1
  • 11
0
votes
2 answers

jquery.validate does not seem to work with certain inputs where name value includes a dot i.e RegisterModel.Pssword

In my views if I use a model that just has scalar, basic properties i.e [RegisterModel] everything works fine. But if I use a view model type where one or more properties is set to another .net complex type, say [RegisterModelAndLogOnModel] then the…
0
votes
1 answer

Required Validation based on condition

public string InsuredName { get; set; } public string Card_No { get { return this.card_No; } set { this.card_No = value; } } here…
Nighil
  • 4,099
  • 7
  • 30
  • 56
0
votes
1 answer

MVC Ajax.beginform partial validation logic inconsistent

I am using MVC 3 and razor in Visual Studio 10 with client side unobtrusive validation. I have a requirement to offer the user an opportunity to save a form fs some of the required fields are missing. The submit is with an Ajax.bgein form…
Peter Smith
  • 5,528
  • 8
  • 51
  • 77
0
votes
1 answer

mvc3 + jQuery validation: how to catch error or ok events

I'm using MVC3 C# and I have a model with some data annotation (validation rules) In my view.cshtml file I have a form with some complex logic that draw some figures using absolute coordinates over existing elements. When user submit the form with…
0
votes
1 answer

MVC3 Ajax.BeginForm hooking submit event before validation

I am using an Ajax.BeginForm with unobtrusive validation. I want to give the user the option to save the data with a minimum number of validated fields (which might be zero) but allow some required fields to be saved when empty. I think my…
Peter Smith
  • 5,528
  • 8
  • 51
  • 77
0
votes
2 answers

Preventing form from being submitted with manual validation

I implemented some custom validation logic with JQuery and Unobtrusive validation with help of the following post: Manually set unobtrusive validation error on a textbox To save you time reading through that post here is the simple javascript that…
InspiredBy
  • 4,271
  • 6
  • 40
  • 67
0
votes
1 answer

Validate only ajax loaded partial view

I have a form with some controls. There is a button on the form which loads a partial view. Inside the partial view, there are two required field textboxes along with a button. And when its clicked, I need to display error messages only for…
Sunny
  • 4,765
  • 5
  • 37
  • 72
0
votes
1 answer

ASP.NET MVC 3 - Custom client side validation not working

I'm trying to implement a custom client side validation, but it is not working. I'm basing myself on the article on Codeproject http://www.codeproject.com/Articles/275056/Custom-Client-Side-Validation-in-ASP-NET-MVC3 I also looked here on SO, but I…
0
votes
1 answer

Jquery validator reset $.validator.setDefaults({ onfocusout: false, onkeyup: false }); in MVC3

are there any way to reset $.validator.setDefaults({ onfocusout: false, onkeyup: false }); in MVC3. I want to change the value in to some thing like $.validator.setDefaults({ onfocusout: true, onkeyup: true }); after I click a button. How to…
0
votes
1 answer

Unobtrusive validation of collection

My model contains a collection: public ICollection ChildAges { get; set; } This is a dynamic list of ages that can be added to, this is all controlled via JQuery. giving me
Liam
  • 27,717
  • 28
  • 128
  • 190