I've been given this task at work and am flying blind as a non-developer so any help much appreciated. I've got a form with

A set of 5 checkboxes (field = 'risk')
A separate checkbox (field = 'no')

The user can select from the top options, OR select No, but if they try and pick from the five, and also No - these are mutually exclusive and an error message is needed. I've tried a few things most recently:

function ValidateMe(f) {var maxchecked = 1;
var count = 0;
if(f.risk[0].checked == true) { count++; }
if(f.risk[1].checked == true) { count++; }
if(f.risk[2].checked == true) { count++; }
if(f.risk[3].checked == true) { count++; }
if(f.risk[4].checked == true) { count++; }
if((count >= maxchecked) && (f.no.checked == true))
{alert('Sorry, only a risk choice OR 'No' may be checked, but not both');
return false;
return true;

and it doesn't do anything - any ideas of why, or a better way to do this?