hello,
i am making a form using php/html/javascript
a part of the form is (email address) comming from a database.
the amount of addresses is always different.
every address has a checkbox.
people have the check at least one checkbox.
i have made a form check to see of at least one checkbox is selected.
this workts fine.
but the problem is:
when there is only one address the form validation does not work!
i cannot get it to work.
thanks,
---------------------------- source code form ---------------------
<form onsubmit='return FormZoekMail(this)' name='mail' action='<? echo
$_SERVER['PHP_SELF']; ?>' method='post'>
<input type='checkbox' name='mailadres[]' value='some value'>
---------------------------------------------------------------
----------------------- source code javascript
function ----------------------
function FormZoekMail(hetForm){
leeg = 0
aantalElementen = 0
aantalElementen = hetForm['mailadres[]'].length;
kort = hetForm['mailadres[]'];
for(x = 0; x < aantalElementen; x++){
if(kort[x].checked != true){
leeg++;
}
}
if(leeg == aantalElementen){
alert('u moet minstens een mailadres selecteren');
return(false);
}
-----------------------------------------------------------------