Validating checkbox[] array (solved..thanks)
Date: 12/18/06
(Javascript Community) Keywords: no keywords
I can't figure out how to access each labno[] value in my validation loop. The following example results in 5 messageboxes appearing - the first says 4, then undefined, undefined, undefined, undefined.
If I remove the apostrophes around labno[] (in the second alert line), the script dies with an error.
I'm stuck here and would greatly appreciate any pointers..
Code:
EDITED:
Fixed with the following CheckForm33 function:
function CheckForm33(theForm)
{
labnos = document.frmAdd.elements['labno[]'].length;
alert(labnos);
for(i=0; i< labnos; i++)
{
alert(document.frmAdd['labno[]'][i].value);
}
}
Source: http://community.livejournal.com/javascript/121012.html