哪里是MicrosoftMvcJQueryValidation.js对MVC 2 Beta 2的版本正确? [英] Where is the right version of MicrosoftMvcJQueryValidation.js for MVC 2 beta 2?
问题描述
MicrosoftMvcJQueryValidation.js
所使用的ASP.NET MVC 2的客户端验证。
MicrosoftMvcJQueryValidation.js
is used by ASP.NET MVC 2 for client side validation.
有这个文件只是不能正常工作,不知道如果我有错误的版本问题。
Having problems with this file just not working properly and wondering if I have the wrong version.
我使用的版本来自于源期货。
The version I am using came from the source for futures.
MicrosoftMvcJQueryValidation.js
5,626 bytes
11/17/09 10:43:12am
有两个原因,我想我有错误的版本:
There are two reasons i think i have the wrong version :
1)我实际上是把这个code得到验证例程的所有工作。这是因为默认客户端验证函数现在嵌入到 FormContext.cs
是 Sys.Mvc.FormValidation.enableClientValidation
。
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 FormContext.cs
is Sys.Mvc.FormValidation.enableClientValidation
.
ViewContext.FormContext.ClientValidationFunction = "EnableClientValidation";
2)从jquery.validate.js一些code,它执行跟随着:
2) There is some code from jquery.validate.js which does the followin :
this.settings.errorPlacement
? this.settings.errorPlacement(label, $(element) )
: label.insertAfter(element);
这调用这个函数在 MicrosoftMvcJQueryValidation.js
:
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);
},
问题是,元素已被包裹 jQuery.validate
与jQuery的 $(元素)
前pression。
The problem is that element has been wrapped by jQuery.validate
with the jQuery $(element)
expression.
所以 element.attr(名称)
是不确定的,但元素[0] .attr(名称)
是有效的。
Therefore element.attr("name")
is undefined, but element[0].attr("name")
is valid.
我已经采取了 MicrosoftMvcJQueryValidation.js
从期货上下载的微软的网站。
`
I've taken MicrosoftMvcJQueryValidation.js
from the futures download on Microsoft's site.
`
我无法找到任何其他 MicrosoftMvcJQueryValidation
版本 - 但我敢肯定有必须有一个。谁能帮助?
I cant find any other MicrosoftMvcJQueryValidation
version - but I'm sure there must be one. Can anyone help?
推荐答案
截至2009年12月17日的最新版本 MicrosoftMvcJQueryValidation.js
是<一个可用href=\"http://$c$c.google.com/p/arscloud/source/browse/trunk/MvcFutures/MvcFutures/MicrosoftMvcJQueryValidation.js?r=7\"相对=nofollow>期货下载项目。
As of Dec 17, 2009 the latest version of MicrosoftMvcJQueryValidation.js
is available in the futures download project.
注意,包括 MicrosoftMvcJQueryValidation.js
和<一个href=\"http://stackoverflow.com/questions/1934803/how-do-i-use-microsoftmvcvalidation-js-without-having-to-include-microsoftajax-js\">NOT相似地名为 MicrosoftMvcValidation.js
。
这篇关于哪里是MicrosoftMvcJQueryValidation.js对MVC 2 Beta 2的版本正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!