从验证摘要中删除重复消息 [英] Remove duplicat message from validation summery

查看:83
本文介绍了从验证摘要中删除重复消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面有更新面板和验证摘要。

当我第一次点击按钮然后夏季显示正确的消息没有重复。但是当页面发回然后再次按下按钮然后summery显示重复的消息,如下图:



缺少售后购买日期值。 
Call In Date值缺失。
修复日期值缺失。
缺少评论值。
缺货售后购买日期值。
Call In Date值缺失。
修复日期值缺失。





我尝试过:



我尝试用jquery删除重复的消息。它删除重复但在它之后添加重复自动夏天。



函数验证(){

Page_ClientValidate();

var optionTexts = [];

$(#valSummary ul li)。each(function(){

//alert($.inArray($ (this).text(),optionTexts));

if($ .inArray($(this).text(),optionTexts)!= -1){

//找到它

$(this).remove();

}

else {

optionTexts .push($(this).text());



}

});

}

解决方案

(#valSummary ul li)。each(function(){

// alert(


.inArray(

(本)的.text (),optionTexts));

if(


I have one page with update panel and validation summary.
When I 1st click on button then summery display proper message no duplicate. but when page post back then again press button then summery shows duplicate message like bellow:

Aftermarket Purchase Date value is missing.
Call In Date value is missing.
Repairing Date value is missing.
Comments value is missing.
Aftermarket Purchase Date value is missing.
Call In Date value is missing.
Repairing Date value is missing.



What I have tried:

I tried with remove duplicate message with jquery. It removes duplicate but after it add duplicate automatic in summery.

function Validation() {
Page_ClientValidate();
var optionTexts = [];
$("#valSummary ul li").each(function () {
//alert($.inArray($(this).text(), optionTexts));
if ($.inArray($(this).text(), optionTexts) != -1) {
// found it
$(this).remove();
}
else {
optionTexts.push($(this).text());

}
});
}

解决方案

("#valSummary ul li").each(function () {
//alert(


.inArray(


(this).text(), optionTexts));
if (


这篇关于从验证摘要中删除重复消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆