I am almost there! But I need help with the following code.
I have an array called room_quantity, and when the site user submits, it check to see if a least one room has a value, otherwise the javascript halts the submit.
I have got it to find the room_quantity[], but it throws an alert up at the first blank find. can someone help me so it continues to check the rest of the array before either returning true (if at least one HAS a value) or false if there array is totally clear?
Code so far:
for (var i=0;i<document.frmFrm.elements.length;i++) {
var el = document.frmFrm.elements;
if (el.name == "room_quantity[]") {
if (el.value == "" || el.value < 1) {
alert("You have not selected any rooms to book, please enter at least one room that you require.\n\nYou can change this at a later date.");
return false;
}
}
}