 <ol> <li>Your FOR loop: since JS uses zero-based arrays, you can't have <strong>&lt;=</strong>, otherwise it will look for an index one higher than what you have. Use <strong>&lt;</strong> instead;</li> <li>I moved your validation for whether any fields were checked outside the loop to make management easier. It's cleaner this way than worrying about breakout out of loops in the middle of them.</li> </ol> <p>Here:</p> <pre><code>function isNull() { var isChecked = false; var radiobutton = document.getElementsByName('radiobtn'); for (var i=0; i &lt; radiobutton.length; i++) { if (radiobutton[i].checked) { isChecked = true; } } if ( !isChecked ) { alert("Make a selection."); return false; } } </code></pre> <p>I don't know how your form tag looks, but here is what you need to prevent the form from submitting if no radio fields are checked:</p> <pre><code>&lt;form action="" method="post" onSubmit="return isNull();"&gt; </code></pre>