Javascript alert not working during form validation
<p>I am not sure what is the mistake but I can't get the alert when I press the button without selecting the checkboxes. Can someone let me know what mistake am I making here.</p>

<pre><code>&lt;html&gt;  
    &lt;head&gt;
        &lt;script type="text/javascript"&gt;
            function validator(form) {
                if (form.q36.value.length == 0) {
                    alert("Select one environment");
                    form.q36.setfocus();
                    return (false);
                }
                if (form.q56.value.length == 0) {
                    alert("Select one environment");
                    form.q56.setfocus();
                    return (false);
                }
                if (form.q77.value.length == 0) {
                    alert("Select one environment");
                    form.q77.setfocus();
                    return (false);
                }

                if (form.apppath.value.length == 0) {
                    alert("Enter the path");
                    form.apppath.setfocus();
                    return (false);
                }
                return (true);
            }
        &lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;form action="/car.java" onsubmit="return validator(this);"&gt;
            &lt;br /&gt;
            &lt;p&gt;One
                &lt;input name="q36" id="q36" type="checkbox" /&gt;Two
                &lt;input name="q56" id="q56" type="checkbox" /&gt;Three
                &lt;input name="q77" id="q77" type="checkbox" /&gt;
            &lt;/p&gt;
            &lt;br /&gt;
            &lt;input name="apppath" size="123" style="width: 766px; height: 21px;" type="text" /&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;input name="uipath" size="123" style="width: 766px; height: 21px;" type="text" /&gt;
            &lt;/p&gt;
            &lt;textarea cols="95" name="status" rows="11"&gt;&lt;/textarea&gt;
            &lt;input name="sub" size="28" style="width: 156px; height: 29px;" type="button" value="Deploy" /&gt;
            &lt;/p&gt;
        &lt;/form&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
