Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3802270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:10:56+00:00 2026-05-19T14:10:56+00:00

I am extending MVC 3 validation by using custom ValidationAttributes on the server side

  • 0

I am extending MVC 3 validation by using custom ValidationAttributes on the server side and have implemented IClientValidatable to output html5 data attributes for my custom validation. I then used jQuery.validator.addMethod to add my client side validation. My final task is to write the adapter that converts the html5 data attributes into a format that the jQuery validator understands. My validation takes in several values so I need to use the jQuery.validator.unobtrusive.adapters.add rather than one of the more straightforward functions such as addSingleVal.

Within my adapter, it would be useful to use several of the functions in the jquery.validate.unobtrusive file such as setValidationValues and getModelPrefix but if I am not mistaken, these function are inside a closure making them only available within that closure. I do not really want to put my custom functions in a microsoft owned script file that may change, so unless anyone has any ideas, I am forced to replicate these functions in my own file which is obviously not ideal.

So any ideas and what do other people do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:10:56+00:00Added an answer on May 19, 2026 at 2:10 pm

    I am afraid not.
    As you know these functions are implement like this:

    (function ($) { 
       ...  
       function setValidationValues(options, ruleName, value){
          //the implementation 
       }
       ...  
    }(jQuery))
    

    as long as this function defined within a private scope you can not access it from out side, it kind of private function for a class. The purpose of defining these kind of functions is you may not access them outside of scope.
    minifier methods are also aware of this FACT and use it to compress js as much as possible. if you look at the minified version jquery.validate.unobtrusive.min.js it prove itself that there is no longer a setValidationValues function but (some letter) x function.

    It’s not a big deal of copy and pasting for these function as long as they are too short to concern about their sizes. With minifier you can get this function and other 3 other function for just 200 bytes. and this 200 byte will be use only once.


    However, there is a way if you use the minified version you can look up the name of functions and place it in your adapter.add(function(){//use their name here}), you would notice that copy and pasting is better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a SAX parser in Java by extending the default handler. The
i am extending the default asp.net mvc example.. i am using asp.net membership provider
I have an ASP.NET MVC (using the release candidate) application that works with a
I am extending a template class using C++ in Visual Studio 2005. It is
I understand the reason for having the HTML helpers in ASP.NET MVC and extending
I am basically taking the default ASP.NET MVC template and extending it: Looking at
I have written an ASP.NET MVC application that runs inside an IFrame. When one
When extending classes, I find it very descriptive to use the base ( MyBase
I'm new to extending Drupal, though I've done similar kinds of things for other
I am extending a class defined in a library which I cannot change: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.