Jscript validation problems

Results 1 to 2 of 2

Thread: Jscript validation problems

  1. #1
    Join Date
    Dec 1969

    Default Jscript validation problems

    I have this javascript validating function. It works good except for the fact that i have 36 fields to validate. The problem is the if statement to test to see if field 1 has something in it if it has something in it to test to be sure field 2 has something in it.(thats what i am trying to accomplish) what my code does is its bringing up the alert box when it shouldnt unless there is a bug. the code:<BR><BR>&#039theform is the name of my form<BR>&#039billtocode is field 1 and billoflading is field 2 so when billtocode is blank i dont want to bring up the alert box<BR><BR>var i;<BR> var o=document.theform.all;<BR><BR> for (i=0; i&#060;o.length; i++)<BR> {<BR> if (o.item(i).type==&#039text&#039)<BR> {<BR> &#039 left out the first part of the if statement since that part of the validation works<BR><BR>else if (o.item(i).name.substr(0,12)==&#039billoflading&#0 39)<BR> {<BR><BR>this is where my error is-&#062; <BR>if (document.theform.billtocode+i.value!=&#039&#039 & o.item(i).value==&#039&#039)<BR> {<BR> alert(&#039Fill in Bill of Lading&#039);<BR> o.item(i).focus();<BR> return false;<BR> };<BR> };<BR> };<BR> };<BR><BR>Matt

  2. #2
    Join Date
    Dec 1969

    Default RE: Jscript validation problems

    ok maybe this is a stupid question - what&#039s the +i ?<BR><BR>if (document.theform.billtocode+i.value!=&#039&#039 & ...... <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