简体   繁体   English

MVC 3:客户端验证事件后的Javascript

[英]MVC 3: Javascript After client side validation event

I need to convert client side validation errors (class="field-validation-error") to tooltip. 我需要将客户端验证错误(class =“ field-validation-error”)转换为工具提示。 This is not a problem with some jQuery tricks! 这不是一些jQuery技巧的问题!

But I need to execute this conversion after client side validation. 但是我需要在客户端验证之后执行此转换。 I do not know if exist a "validate" event on the form or on the single field. 我不知道是否在表单或单个字段上存在“验证”事件。

this is a client side validation triggered while typing (not while submission) then I need an event that is fired when the field value changed. 这是在键入时(而不是在提交时)触发的客户端验证,然后我需要一个在字段值更改时触发的事件。

The best is the same event that change (Using standard MVC client validation) the class of the "input" to "input-validation-error". 最好的情况是同一事件(使用标准MVC客户端验证)将“输入”的类更改为“输入验证错误”。

Thank You!! 谢谢!!

I'm not sure this will help but try this code: 我不确定这是否有帮助,但是请尝试以下代码:

var currentValidate = Sys.Mvc.FormContext.prototype.validate;

var newValidate = function(eventName) {
   var result = currentValidate.call(this, eventName);
   // Perform post-validation logic here
   return result;
};

Sys.Mvc.FormContext.prototype.validate = newValidate;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM