<!DOCTYPE html>
<html  xmlns="http://www.w3.org/1999/xhtml">

<!--
    demo of form validation using JavaScript

    by: Sharon Tuttle
    last modified: 2016-04-11
-->

<head>  
    <title> JavaScript form validation </title>
    <meta charset="utf-8" />

    <link href="http://users.humboldt.edu/smtuttle/styles/normalize.css" 
          type="text/css" rel="stylesheet" />
    <link href="three-value-form.css"
          type="text/css" rel="stylesheet" />

    <script src="allFilled.js" type="text/javascript"
            defer="defer"> </script>

    <script type="text/javascript">

        // attach an onsubmit attribute to this
        //    page's form to make sure its
        //    contents are "reasonable" prior
        //    to allowing it to be submitted

        window.onload = 
            function()
            {
                var valueForm = 
                    document.getElementById("valueForm");

                // you are setting onsubmit to this
                //    function, NOT to the result
                //    of CALLING it...

                valueForm.onsubmit = allFilled;
            };
    </script>    

</head> 

<body> 
    <h1> JavaScript form validation example </h1>

    <p id="errors"> </p>

    <form action="three-value-response.php"
          method="get"
          id="valueForm">
        <fieldset>
            <legend> Enter values for application </legend>
            <label for="value1">
                String Value 1: </label>
            <input type="text" name="first"
                   id="value1" required="required" /> <br />

            <label for="value2">
                Numeric Value 2: </label>
            <input type="text" name="second" class="right"
                   id="value2" value="13" 
                   required="required" /> <br />

            <label for="value3">
                Value 3: </label>
            <input type="text" name="third" 
                   id="value3" required="required" /> <br />

            <div class="sub_button">
                <input type="submit" value="submit values" />
            </div>
        </fieldset>
    </form>

<?php
    require_once("328footer-better.html");
?>

</body>
</html>