[Javascript] Loop problem

Alexandre Zglav azglav at heritage.ch
Tue Mar 18 06:50:39 CST 2003


It seems that there was a problem with the formating of my email so here 
is a .txt version of the code 



_____________________________________
IT Projects
Alexandre Zglav 
Heritage Finance and Trust Company
12 cours des bastions 
1205 Geneva
Switzerland 
Phone :  ++ 41 22 817 31 68 
----------------------------------------------------------------
This document should only be read by those persons to whom it is
addressed  and  is  not intended to be relied upon by any person
without  subsequent written confirmation of its contents. If you
have  received  this  e-mail message in error, please destroy it
and delete it from your computer.
Any  form of  reproduction, dissemination, copying,  disclosure,
modification,  distribution  and/or  publication  of this E-mail
message is strictly prohibited.
----------------------------------------------------------------




"Alexandre Zglav" <azglav at heritage.ch>
Sent by: javascript-admin at LaTech.edu
18.03.2003 13:44
Please respond to javascript

 
        To:     javascript at LaTech.edu
        cc: 
        Subject:        [Javascript] Loop problem


Hello all. 

I quite new to javascript and I have a problem with a loop and I just cant 

find a solution to it on the internet.

I am trying to validate a for m with a variable amount of fields. 

Here is the code i am using :


<!-- 

function CheckForm(form1) {
 
        var why ="";
 
        for (i=1;i=<%=Numfrm%>;i++) 
                why += checkName(form1.name[i].value);
                if ( why != "") {
                        alert(why);
                        return false;
                }

}


function checkName (strng) {
        var error = "";
 
        //test of the filling
        if (strng == "") { 
                error = "you didn' enter a username. \n";
        }
        return error;
}

 
-->

Note that <%=Numfrm%> is a the variable i am retrieving from ASP. It 
returns me an integer value chosen in an earlier field. 

Now my problem is at this point : 

why += checkName(form1.name[i].value);

It seems that [i] is not accepted as I always get an error at this level 
in my script debugger.

Can someone help me with this ? 

Thanks in advance. 

Best regards. 
_____________________________________
IT Projects
Alexandre Zglav 
Heritage Finance and Trust Company
12 cours des bastions 
1205 Geneva
Switzerland 
Phone :  ++ 41 22 817 31 68 
----------------------------------------------------------------
This document should only be read by those persons to whom it is
addressed  and  is  not intended to be relied upon by any person
without  subsequent written confirmation of its contents. If you
have  received  this  e-mail message in error, please destroy it
and delete it from your computer.
Any  form of  reproduction, dissemination, copying,  disclosure,
modification,  distribution  and/or  publication  of this E-mail
message is strictly prohibited.
----------------------------------------------------------------
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: New Text Document.txt
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030318/1b94a3c9/attachment.txt>


More information about the Javascript mailing list