如何检查我的文本框是否没有重复任何值? [英] How can i check if my textboxes is not repeating any value?

查看:81
本文介绍了如何检查我的文本框是否没有重复任何值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii,

我的模型弹出窗口中有大约10个文本框..



我要验证5个文本框。如果这五个中的任何一个具有相同的值编号,那么用户然后我想要显示该值已经存在的任何错误。



建议我尽可能使用jquery。



添加已经尝试过的代码来自< br $> b $ b

Hii,
I have around 10 text boxes in my model popup ..

from that i want to validate 5 text boxes. if any one of this five have same value number then user then i want show any error that the value is already exist.

suggest me in jquery if possible.

Added already-tried code from comment

function CheckDoubleEntry(source , args)
{
    var arrNumb = new Array(6);
    arrNumb[1] = document.getElementById('<%=txtManagerRatingOrder.ClientID%>').value;
    arrNumb[2] = document.getElementById('<%=txtEmployeeRatingOrder.ClientID%>').value;
    arrNumb[3] = document.getElementById('<%=txtDesiredLevelOrder.ClientID%>').value;
    arrNumb[4] = document.getElementById('<%=txtEmployeeLevelOrder.ClientID%>').value;
    arrNumb[5] = document.getElementById('<%=txtManagerLevelOrder.ClientID%>').value;
    arrNumb[6] = document.getElementById('<%=txtAgreedLevelOrder.ClientID%>').value;
    for(i=0; i<6; i+=1) 
    {
        if (arrNumb[i] == args.value)
        {
            args.IsValid == false
        } 
        else {args.IsValid == true}
    }
}





[/ EDIT]



[/EDIT]

推荐答案

您可以使用JQuery尝试类似下面的内容。

You can try something like below using JQuery .
function CheckDoubleEntry() {


.text-box)。each( function (){
// text-box - 为文本框提供的类名称,您想要的5个文本框验证
function (index,element){
(".text-box").each(function () { //text-box - the class names provided for the textbox the 5 textboxes you want to validate function (index, element) {


.text-box)。each( function (){

function (innerindex,innerElement){
if (index!= innerindex)
{
if
(".text-box").each(function () { function(innerindex, innerElement) { if (index != innerindex) { if (


这篇关于如何检查我的文本框是否没有重复任何值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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