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
array validation
Moderator: General Moderators
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++)
{
if (!blaїi]) //that's the line you want
alert ("Array Index "+i+" empty");
}
</script>