ASP.Net MVC Unobtrusive Validation Bug

If you use the ASP.Net MVC 3 [Compare] validation attribute on a model property, then include that model as a property in a parent model (so that the field name becomes Parent.ChildProperty), the built-in unobtrusive client validation will choke, and will always report the field as having an error.

This is due to a bug on line 288 of jquery.validate.unobtrusive.js:

adapters.add("equalto", ["other"], function (options) {
    var prefix = getModelPrefix(options.element.name),
        other = options.params.other,
        fullOtherName = appendModelPrefix(other, prefix),
        element = $(options.form).find(":input[name=" + fullOtherName + "]")[0];

    setValidationValues(options, "equalTo", element);
});

Because the value of the name attribute selector is not quoted, this fails if the name contains a ..

The simplest fix is to add quotes around the concatenated value.  However, the jQuery selector there is overkill.  HTML form elements have properties for each named input, so you can do this instead:

adapters.add("equalto", ["other"], function (options) {
    var prefix = getModelPrefix(options.element.name),
        other = options.params.other,
        fullOtherName = appendModelPrefix(other, prefix),
        element = options.form[fullOtherName];
    if (!element)
        throw new Error(fullOtherName + " not found");
    //If there are multiple inputs with that name, get the first one
    if (element.length && element[0])        
        element = element[0];
    setValidationValues(options, "equalTo", element);
});

825 comments:

«Oldest   ‹Older   801 – 825 of 825   Newer›   Newest»

Hi

am more curious to take an interest in some of them. I hope you will provide more information on these topics in your next articles.

Informative Post. The information you have posted is very useful and sites you have referred was good. Thanks for sharing.
Data Science Course with Placement




The best clat coaching in Delhi helps you to pass the clat exam in your first attempt. This article lists thebestclat coaching in delhi. All the institutes listed on our web site provide excellent clat instruction through advanced teaching techniques. In terms of success, knowledge nation law center had a higher selection rate in the previous year, along with each coaching institute using some unique techniques. To prepare for CLAT, you must enroll for coaching according to your needs.



This is an awesome motivating article.I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. Continue blogging. Hoping to perusing your next postfull stack development course
cyber security course in malaysia

Canada Assignment Help includes Ph.D. authors as well as a skilled subject matter professional to assist you in completing the curriculum set by your college/university. So contact us if you are facing any problems in assignment writing.

I really enjoyed reading this post and keep up the good work and let me know when you can post more articles or where I can find out more on the topic.
Data Science Online Course

I want to thank you for your efforts in writing this article. The information provided was very useful.
Data Science Certification Bangalore

Thanks for your info! If you want to grow your business revenue through best digital marketing strategy Visit Us

ANZSLOT Situs slot pay4D terpercaya bonus 100% didepan deposit pulsa 24 jam tanpa potongan paling gacor se Indonesia.

Hi there!You have made some decent points there. I just want to offer you a big thumbs up for the great info you have right here on this post. I am returning to your website for more soon.
바카라

Thank you for sharing such a great bog it is very helpful.
바카라

I simply want to tell you that I am just beginner to blogs and really enjoyed you’re web page. Very likely I’m planning to bookmark your site . You really have fantastic posts. Thank you for sharing
파워볼게임

Hi, I am John Smith I am Web Developer, It is an amazing blog thanks for the sharing the blog. Frantic infotech provide the ui/ux android app development such as an information about software development for costumer service. Frantic infotech also provide the android app development. Theve delopment of advanced web applications is Orient Software’s specialty and we will successfully fulfill all your web application development requirements, from small-sized to wider-ranged projects.

About the Bali honeymoon packages from Bangalore : Bali is a heaven for honeymooners. If you are planning a honeymoon in Bali, you don't have to go out of your budget because there are many honeymoon packages available all over Bangalore. There are many travel agents in Bangalore that offer all inclusive Bali honeymoon packages deal in Bangalore.

The substance on the site comes from many sources and a site like tainiomania has no subscriptions to its employees. Facilitating the recordings will do him a disservice. However, the site only links to these recordings and does not have them. Then he does not perform specialized tasks unjustly. tainiomania ,.kjub,

Selenium is the widely used web-based automation testing technology that creates tremendous job opportunities for freshers and experienced candidates. The learning of the Selenium Course in Chennai brings worldwide opportunities to become automation engineers, QA professionals, Selenium Testing Engineer, etc.
Selenium Training in Chennai

A debt of gratitude is in order for giving late reports with respect to the worry, I anticipate read more. data analytics course in surat

Your site is truly cool and this is an extraordinary moving article. business analytics course in mysore

Thank you for this wonderful information. We are Providing the best quality Finance assignment help service. We can provide information about any topic related to the academics. If you need any college level Assignment Help at reliable quality with better work. Kindly visit our website for more details.

While you're checking your Yahoo letter drop from a program, you can admittance to this tab from the left menu by clicking Views and Photos. Indeed, you can contact Yahoo backing and solicitation for information reclamation.
Yahoo customer service toll free number |
Yahoo Photos recovery |
Yahoo mail login

What is Trimix Injection Price? What are the side effects of Trimix Injection Price? What are the precautions needed to be followed with Trimix Injection Price?

The selection of best and safe online pharmacy is an important issue while buying Trimix Injection Price. You need to know how much a drug costs, how you can order it, how to pay for it and how to get it.

Trimix Injection Price cost: Trimix Injection Price cost can be different in various brand and package sizes. Check out the details provided below to know the exact cost of Trimix Injection before you buy Trimix injections online.

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I’ve got you bookmarked to look at new stuff you post… 먹튀사이트

At Kickr Technology, the best web designing company on Noida, we are a team of designers, who have acquired scientific and artistic skills for creating a thoughtful design for your site. Our website will work as your sales representative in the virtual world.

Hello There. I found your blog using google. This is a very well written article. I'll be sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will definitely return. If you want write for us please visit here:write for us fashion

«Oldest ‹Older   801 – 825 of 825   Newer› Newest»

Post a Comment