Validate 2 text boxes

Results 1 to 2 of 2

Thread: Validate 2 text boxes

  1. #1
    Join Date
    Dec 1969

    Default Validate 2 text boxes

    I’m using the Validate script to compare two text boxes. It works only of the there is one record. If the “EOF” displays more then one record set the table the code will not work. Can anyone help?<BR><BR>&#060;form name=form1 action="blah" onSubmit="return validate()"&#062; <BR>.... <BR><BR>&#060;/form&#062; <BR><BR>&#060;Script language="JavaScript"&#062; <BR>&#060;!-- <BR>function validate(){ <BR>if (document.form1.TextBoxA.value==document.form1.Tex tBoxB.value){ <BR>alert(&#039;values cannot match&#039;); <BR>return false; <BR> <BR>}else{ <BR>return true; <BR>} <BR>} <BR>//--&#062; <BR>&#060;/Script&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default Use different names...

    ...for every form field.<BR><BR>If you don&#039;t, the DOM converts the same-named fields into arrays.<BR><BR>Thus you would want to have, for the first record,<BR> TextBoxA1 and TextBoxB1<BR>The second record would have<BR> TextBoxA2 and TextBoxB2<BR>etc.<BR><BR>Hopefully, you are using names that are more descriptive of the real purpose than "TextBoxA", et al.<BR><BR>

Posting Permissions

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