sorry guys, I didn´t explain it in detail.
I have the "parent" array called province, and its child city. province must have just one child with the same value. I know that city value 2 is child of province value 5, so province must have only one city[2], not more.
I the user "selects" two, an alert have to run when user submit.
this is the function wich creates the arrays:
Code:
function Values(form1){
frm = document.forms[0];
province = [];
city = [];
total_selects=document.forms["form1"].getElementsByTagName("select").length/2;
for(i=1;i<=total_selects;i++){
if(eval("document.getElementById('province"+i+"').value==0")){
alert("Provincia está vacio");
return false;
}else{
province.push(eval("document.getElementById('province"+i+"').value"));// to fill the array province
}
if(eval("document.getElementById('city"+i+"').value==0")){
alert("Ciudad está vacio");
return false;
}else{
city.push(eval("document.getElementById('city"+i+"').value"));// to fill the array city
}
}
document.form1.province.value = province; //here are both arrays
document.form1.city.value = city;
}
thanks!!
Bookmarks