Results 1 to 2 of 2

Thread: Validation of text boxes

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Malaysia
    Posts
    345

    Validation of text boxes

    In a form I've many controls and some text boxes which I've created on the fly.I have to do a javascript validation so that i dont put duplicate entry in the text boxes which were created on fly. I'm having problem with the syntaxes.


    The code i'm writing is something like this..pls help me on this.var index = 1;

    obj = document.frmStocks.elements;
    icount = obj.length;
    for (i = 0; i < icount; i++)
    {
    if (obj(i).name == 'txtDrum' + index)
    {
    for (j= 1;j< icount; j++)
    {
    alert(index);
    alert(j);
    if (index!=j)
    {
    /if (obj(index).value == obj(j).value)
    //alert("sid" + i);
    //alert("sin" + j);
    /alert(('txtDrum' + index).value);...this gives //undefined
    if ('txtDrum' + index.value == 'txtDrum' + j.value)
    {
    alert("duplicate");
    return false;
    }
    }
    }
    index++;
    }
    }
    Thanks.

  2. #2
    Hyperactive Member bsw2112's Avatar
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    292
    can u post a link to this page all provide all the code?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width