Scripting problem with for each

Scripting problem with for each

I'm having problem running a script based on the simple booking shared app. I am trying to use the following script on validate:

for each reservation in Booking_Form
{
if ((reservation.field11 != null) && (input.field11 != null))
{
alert "not available";
cancel submit;
}
}

field11 is a checkbox in the form. I basically want it to reject a submission if a previous submission had that fields checkbox also checked. It keeps returning an error that reservation is null. Any help?