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);
});

827 comments:

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

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

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.

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

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

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

get the best electric kettles at the reasonable prices available in india
from below
https://indiatopbest.in/best-electric-kettle/

Have you ever tasted the Jackfruit Chips from Nagercoil?.. Sweetkadai.com delivers the Best Jackfruit Chips at your doorstep.. Order now!!

Sparkling chess academy is run by international rated players. We have a long journey of success because of our commitments, dedication and love for the game of chess. We believe in “practice makes men perfect” that’s why we are running our chess academy all seven days. Our main objectives are to bring out our student’s full potential and his/her all round development. We have chess academy in Delhi, Noida & Faridabad.

//old-blog.slaks.net/2012/02/aspnet-mvc-unobtrusive-validation-bug.html

http://tech.agora.org/2015/06/google-apps-for-education-is-live.html?sc=1659963368088#c8502427072550134193

People going in the FinTech era must know What Bank Is Cash App On Plaid. It is a kind of certain technique the bank use to integrate with the plaid for making the customer's experience better. But sometimes, you might not realize the tactics and may fall into trouble. This is why choosing the working tactics can help you get to the information at once. A cash app is a system that allows the transactional aspect through secure methods. Most often the lack the complete information leads to troublesome kind of factors and finally cash app users could not deal with it. This is why; they may select to take the help of the support team.

If you are one of those users who are looking forward to knowing the usages of Cash App Fee Calculator, you have to make use of expert’s backing and supervision so that you can leverage the benefits of Cash App at its best. However, if you are having any kind of hassle regarding the same, you have to contact the Cash App support engineers who will help you to use the Cash App calculator at its best.

Of course, there is an eligibility criterion that you have to match if you would like to use Cash App Borrow feature to borrow money directly from Cash App. However, if you meet the criteria and are ready to take a loan, you should make sure that you can take money from $20 to $200 without any kind of problems. Apart from that, you should have a word with the Cash App geeks who will let you know all about the same.

This very informative and interesting blog.
Tire repair near me

This very informative and interesting blog.
sell my house fast ontario

Hi, Thanks for sharing your blog. Please review mine.

CureMeDoc | DigiBharata

Regards


very creative blog!!! I learned a lot of new things from your post. It is really a good work and your post is the knowledgeable. Waiting for your more updates.

Angular Training in Madurai
Best Angular Training in Madurai

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

Post a Comment