Please send questions to st10@humboldt.edu .

*   <form> HTML tag syntax...

    <form> .. </form>

    *   and can have <input> tags representing components like
        buttons, text boxes, checkboxes, etc.

        *   for example --- consider a simple button

        *   its tag (for example):  
                      <input type="button" value="button label"
                             onclick="what you wanna do">

        *   simple example: js_form1.html

    *   some important form attributes:

        *   name attribute - lets you access this form by that
            name --- e.g.

            <form name="george">

            ... then document.george refers to this form object

        *   (if you don't give it a name, you can still "reach" it
            via the document object's forms property...

	    e.g., document.forms[0] would be a document's first form

            *   and remember the JavaScript array length property...
 
                document.forms.length would be the number of form
                objects in this document!

        *   action attribute: is used to specify a URL to take
            appropriate action when a form is submitted

            *   this action attribute's value can be a:
                *   URL referencing a server-side script    
                    *   when the form is submitted, this server-side
                        script will do what it is designed to do
                        with the form's data

                    *   e.g.:
                        <form action="/cgi-bin/handleForm.cgi">

                *   mailto URL
                    *   when the form is submitted, the form data
                        will be mailed to the address given in mailto
                        URL

                    *   e.g.:
                        <form action="mailto:st10@humboldt.edu">

                *   or a "plain" URL
                    *   when the form is submitted, you just go to that 
                        page

                    *   e.g.:
                        <form action="http://www.humboldt.edu">

        *   method attribute: specifies how the form data is to be
            sent to the server; exactly 2 "legal" values of this
            attribute:   "post" or "get"

            *   "post" is preferred -- form data is sent SEPARATELY
                from the call to the server-side script

                (less likely to be truncated or otherwise cut off)

            *   with "get", the form data is concatenated to the
                end of the URL, and so sometimes gets cut off...
            
                BUT: can be handy during testing, to see what's
                being sent --- we'll use it in that vein in our
                examples.

		(USUALLY, THOUGH --- USE "post"!!)

*   URL encoding: how the form data is formatted by the browser
    to send to the server

    *   each form element's name is paired with that form element's
        value, in a name=value pair

    *   AND these name=value pairs are separated by &

    *   AND spaces in the input are replaced with +

    *   AND special characters are replaced with their ASCII
        hexadecimal equivalents preceded by a %

    *   example: play with js_form2.html

*   a text box:  <input> whose type attribute is "text",
    *   name attribute names this text box (for easy JavaScript
        and server-side reference later)

    *   size attribute: how wide it appears on-screen

    *   maxlength attribute: how many characters the user can type
        into it
   
    *   value attribute: what initially shows in the text box

*   when a form has multiple input elements (or, really, for any
    form that transmitting data), you probably ALSO want:

    *   a submit button (another <input> element)

    *   a reset button (another <input> element)

    *   THEN, the <form> can contain event handler attributes
        onsubmit and onreset to specify WHAT happens when the
        submit button is clicked and the reset button is clicked,
        respectively 

*   submit button: it causes the data of its form to be submitted
    to the URL given in the form's action attribute

    *   <input> tag with a type attribute of "submit"

    *   value attribute is the text you want to appear on the
        button --- if no value attribute, it will show "Submit Query"

    *   usually don't have a name attribute, unless a form
        has multiple submit buttons...

*   reset button: causes the data of its form to be cleared,
    or reset (to their initial values)

    *   <input> tag with a type attribute of "reset"

    *   value attribute is the text you want to appear on the
        button --- if no value attribute, it will show "Reset"

    *   usually don't have a name attribute

    *   these pieces are added to js_form4.html

*   js_form5.html is going to show use of the FORM tag's
    onsubmit and onreset event handler attributes...

*   js_form6.html shows use of onsubmit to do simple form
    validation, and onreset to make sure the user wants to
    clear the form;

    *   to DO this, have an action of "return funct_to_call()"
        instead of just a JavaScript function call;

        then, if funct_to_call() returns true, it PROCEEDS
        with the submit or reset,

        BUT if it returns false, it ABORTS the submit or reset

        *   (note: function called needs to have a return 
            something! (have a return statement))

*   this -  refers to the current object --- inside of a form
    tag, then, this would mean that form