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

45 comments:

Thank you very much. Very complete guide. gmail login

This is useful info about ASP.Net MVC 3. You are very kind when sharing this hotmail log in

Education is really important today. That's why I know that it will be useful for you to know how to write a cover letter. It was helpful for me when I studied in college.

This is useful info about ASP.Net MVC 3.
Android Stock Firmware

You are very kind when sharing this
Mi Home Apk

Thank you very much. Very complete guide.
Download Android USB Drivers

That's why I know that it will be useful for you to know
Driving Zone 2 Mod Apk

It was helpful for me when I studied in college.
Creative Destruction PC

Thank you very much. Very complete guide
Run, sausage, run For PC

The above article is nice and interesting, thank you willing to share! Greetings success of admin Percetakan Murah Rawamangun Jakarta Timur wish you deign to visit my website, thank you :)

Thank you for sharing! I hope you will continue to have great articles like this to share with everyone!
Mobile app development company in toronto

Nice and interesting post,I appreciate your hard work,keep uploading more, Thank you for sharing valuable information.
Mobile app Development Company in Delhi

Useful information for all. It's exactly what I tell my corporate clients(ESL/EFL students)when doing a writing workshop. The main difficulty for us teachers, and/or educators, is when people are so convinced that their Franglais, or Germanglais, or whatever, is correct. On the other hand, the non-native speakers go nuts when bosses, or collaborators, don't write proper emails themselves.

https://is.gd/WTU8yj

Dell Printer Support is a team of experts who takes care of your dell printer issue. Our support is capable of dealing with any dell printer glitches. In case you're having issue with you dell printer contact dell Printer Support and get instant help.

AOL Tech Support covers all your AOL mail related issues. The experts at AOL Tech Support are quite proficient in dealing with your issues with ease. For any help related to AOL, contact AOL Tech Support

Dell Support is a team of experts who takes care of your dell device issue. If face any problem with your device like your device is crashed , device is not working properly or others then contact and get instant help.


https://www.google.se/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=https://techsupportsnumber.com/dell-support/
http://bit.ly/2WrmN9e
https://is.gd/K4460M


Get the best support for your devices at HP Support. Connect with the certified professionals at HP Support Phone Number with 24/7 availability. Avail the top rated solutions to cater to your future technology needs.

https://is.gd/lYuBYS.
http://bit.ly/2F42JDS
https://www.google.se/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=https://techsupportsnumber.com/hp-support/

QuickBooks Support Phone Number is available round the clock to fix all errors. Connect with experts at QuickBooks Support Phone Number with 24/7 availability to resolve all errors associated with QuickBooks. Get best guidance and support for error free software.

Contact to Canon printer customer service technicians and get 24/7 assistance to resolve all your Canon Printer Support issues. For quick assistance, dial Canon printer toll-free phone number.

Confronting various QuickBooks issues? Facing QuickBooks desktop issues or QuickBooks has stopped working? QuickBooks Customer Service has quick answers to all your QuickBooks queries. Acquire the best instant assistance at QuickBooks Customer Service. Experts provide you with quick solutions round the clock at QuickBooks customer Service

Your blog is filled with unique good articles! I was impressed how well you express your thoughts.

Free Download Xender For Pc

Printer Help Services is the biggest supplier of sites in the print business. Our clients see a normal increment in online income of 30%, with our web-to-print item and appreciate boundless Printer bolster administrations. On the off chance that we talk about printers, it is best known for its quality, proficiency, unwavering quality, and efficiency. On the off chance that you are utilizing the printer and having some inconvenience in its task, at that point no compelling reason to stress. Our Printer specialized help group is there to help you in investigating all issues with printers. In the event that any of the issues Persists in the above given, at that point don't hesitate to contact HP Printer Support whenever. We are having a group of specialists and very talented experts who are accessible 24*7 for the assistance of the people. Visit:
Printer Customer Support

TreasureBox is operated by a group of young, passionate, and ambitious people that are working diligently towards the same goal - make your every dollar count, as we believe you deserve something better.
sofa bed nz
gazebo nz

One choice can change everything! With romance, drama, horror and more, Choices has the best collection of story games in the world! ✦ Customize your main character. ✦ Fall in love, solve crimes and embark on epic fantasy adventures. ✦ Pick your story from our constantly growing library with weekly chapter updates.

Choices Hack

Customers can contact technical support via email, chat service or call. Alternatively, they can also get premium support for the stop device with our stop Roku customer service number. You can also visit our website http://webslivesupport.com/roku-customer-service/
AOL desktop gold download for windows 10
AOL mail support phone number
AOL customer service number
roku customer service number


This comment has been removed by the author.

Thanks for posting such a good content,
We have skilled professional developers with 12+ years of experience. Also, our team gives 100% support after delivering project. If you have any requirement regarding Android & iOS mobile app development then you can contact us at tel: +1-877-659-9068.

Thanks for sharing information,
Hire a vehicle on time, Trexeego offer the best service for book taxi online nearby you. We have a wide range car like as Sedan, Xylo, Nissan, Indigo car with expert driver anywhere in India. Feel free or call now at this number +91 7992315344.

Brother Printer is one of the best and widely used printer. If you want Brother Printer Drivers For Windows 10. All you have to do is dial our Brother Printer Support Phone Number .

If You are facing problem in creating Telus email account, recover forgotten Telus account password, Telus email has stopped working or any other issues etc. The support team of TELUS provides you the guaranteed support for your issues. All you have to do is dial our TELUS SUPPORT PHONE NUMBER and get your issues resolved.

Post a Comment