Page 1 of 1

array validation

Posted: Sat Mar 08, 2003 9:36 am
by CrazyJimmy
Hello,

I have a array on my from called name[] which I then pass to a php script. I would like validate this for null values in javascript but cant get it figured out or even know if its possible.

Thanks

Posted: Sat Mar 08, 2003 6:34 pm
by patrikG
This should work:

Code: Select all

<script language=javascript>
bla=new Array(12,5,0,234,0,2365,0); //just some sample values
for (i=0;i<bla.length;i++)
	&#123;
	if (!bla&#1111;i])   //that's the line you want
		alert ("Array Index "+i+" empty");
	&#125;
</script>