Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere is the right version of MicrosoftMvcJQueryValidation.js for MVC 2 beta 2?
    primarykey
    data
    text
    <p><code>MicrosoftMvcJQueryValidation.js</code> is used by ASP.NET MVC 2 for client side validation.</p> <p>Having problems with this file just not working properly and wondering if I have the wrong version.</p> <p>The version I am using came from the source for futures.</p> <pre><code> MicrosoftMvcJQueryValidation.js 5,626 bytes 11/17/09 10:43:12am </code></pre> <p>There are two reasons i think i have the wrong version :</p> <p>1) I actually have to call this code to get the validation routine working at all. This is because the default client validation function now embedded into <code>FormContext.cs</code> is <code>Sys.Mvc.FormValidation.enableClientValidation</code> .</p> <pre><code> ViewContext.FormContext.ClientValidationFunction = "EnableClientValidation"; </code></pre> <p>2) There is some code from jquery.validate.js which does the followin :</p> <pre><code> this.settings.errorPlacement ? this.settings.errorPlacement(label, $(element) ) : label.insertAfter(element); </code></pre> <p>This calls into this function in <code>MicrosoftMvcJQueryValidation.js</code> :</p> <pre><code> errorPlacement: function(error, element) { var messageSpan = fieldToMessageMappings[element.attr("name")]; $(messageSpan).empty(); $(messageSpan).removeClass("field-validation-valid"); $(messageSpan).addClass("field-validation-error"); error.removeClass("input-validation-error"); error.attr("_for_validation_message", messageSpan); error.appendTo(messageSpan); }, </code></pre> <p>The problem is that element has been wrapped by <code>jQuery.validate</code> with the jQuery <code>$(element)</code> expression.</p> <p>Therefore <code>element.attr("name")</code> is undefined, but <code>element[0].attr("name")</code> is valid.</p> <p>I've taken <code>MicrosoftMvcJQueryValidation.js</code> from the futures download on <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=36054" rel="nofollow noreferrer">Microsoft's site</a>. `</p> <p>I cant find any other <code>MicrosoftMvcJQueryValidation</code> version - but I'm sure there must be one. Can anyone help?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload