Validate form using Javascript
<p>I am trying to validate my form using javascript.  If a radio button is not selected, onsubmit the text "You did not select a filling" should appear below the filling section.  The rest of the code works fine.  cslab.bc.edu/~thomasfd/hw8/hw8.php to see it live.</p>

<pre><code>        &lt;script&gt;

    function validateform(){
            var namevalid = validatename();
            var entreevalid = validateentree();
            var fillingvalid = validatefilling();

            return false;

        }


        function displayfilling(){
            var fillingselected =document.forms["mytestform"].filling.value;
            var resultloc=document.getElementById("fillingerror");
            resultloc.innerHTML =  "You have selected " + fillingselected + ".";
        }

        function validatefilling(){
            var a=document.getElementById("myfilling");
            if (a.selectedIndex == 0){
                var resultloc=document.getElementById("fillingerror");
                resultloc.innerHTML =  "&lt;span style='color:red;'&gt;Please select a filling!&lt;span&gt;";
                return false;
            }
            var resultloc=document.getElementById("fillingerror");
            resultloc.innerHTML =  "";
            return true;
        }
&lt;/script&gt;
</code></pre>
