User Tools

Site Tools


eg-259:lecture3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eg-259:lecture3 [2013/02/04 16:35] – [Demonstration] eechriseg-259:lecture3 [2013/02/05 12:23] (current) – [About the Examples] eechris
Line 40: Line 40:
 See the instructions at [[https://github.com/cpjobling/eg-259-vm]]. See the instructions at [[https://github.com/cpjobling/eg-259-vm]].
  
 +  * Go directly to the examples: http://localhost:4567/eg-259/examples/lecture3 
 +  * Browse the source code on GitHub: [[https://github.com/cpjobling/eg-259-vm/tree/master/web/eg-259/examples/lecture3|eg-259/examples/lecture3]]
  
  
Line 87: Line 88:
 ===== Forms ===== ===== Forms =====
  
-  * A form is the usual way information is gotten from a browser to a server+  * A form is the usual way information is gotten from a user to a web application
   * HTML has tags to create a collection of objects that implement this information gathering   * HTML has tags to create a collection of objects that implement this information gathering
   * The objects are called //controls// or //widgets// (e.g., radio buttons and checkboxes)   * The objects are called //controls// or //widgets// (e.g., radio buttons and checkboxes)
Line 97: Line 98:
  
   * The ''<form>'' element is a container for a group of form widgets.   * The ''<form>'' element is a container for a group of form widgets.
-  
   * All of the widgets must be defined in the content of a ''<form>'' tag   * All of the widgets must be defined in the content of a ''<form>'' tag
 +  * There can be any number of independent forms on a single web page
  
 ===== Form — action attribute ===== ===== Form — action attribute =====
Line 112: Line 113:
  
   * The ''method'' attribute of ''<form>'' specifies one of the two possible techniques of transferring the form data to the server, ''get'' and ''post''((Early drafts of the HTML5 added ''put'' and ''delete'' but these have been removed until more is known abut how these verbs should be implemented by browsers. See [[https://www.w3.org/Bugs/Public/show_bug.cgi?id=10671|HTML5 Bug 10671]].))   * The ''method'' attribute of ''<form>'' specifies one of the two possible techniques of transferring the form data to the server, ''get'' and ''post''((Early drafts of the HTML5 added ''put'' and ''delete'' but these have been removed until more is known abut how these verbs should be implemented by browsers. See [[https://www.w3.org/Bugs/Public/show_bug.cgi?id=10671|HTML5 Bug 10671]].))
-  * The ''get'' and ''post'' are discussed in great detail later in the module. +  * The actions of the ''get'' and ''post'' methods are discussed in great detail later in the module. 
-  * The ''get'' method is the default and this is not necessarily a good thing!+  * The ''get'' method is the default  
 + 
 +----
  
 +The fact that the ''get'' method is the default is not necessarily a good thing!
  
  
Line 441: Line 445:
     <form action = "/cgi-bin/echo_params.cgi">     <form action = "/cgi-bin/echo_params.cgi">
       <p>       <p>
-        With <code>size="1"</code> (the default+        With <code>size = "4"</code> (specifiedand <code>multiple</code>.  
-        <select name = "groceries"> +        Note use of <code>selected</code> because we always need bread! 
-          <option value = "milk"> milk </option> +        Ctrl-Click (Command-Click on Mac) to make multiple selections. 
-          <option value = "bread"> bread </option> +        <select name = "groceries" size="4" multiple
-          <option value = "eggs"> eggs </option> +          <option value="milk"> milk </option> 
-          <option value = "cheese"> cheese </option>+          <option value="bread" selected> bread </option> 
 +          <option value="eggs"> eggs </option> 
 +          <option value="cheese"> cheese </option>
         </select>         </select>
       </p>       </p>
Line 603: Line 609:
   * Required fields must have a value before you can submit the form.   * Required fields must have a value before you can submit the form.
  
-====== Example of a Required Field ======+===== Example of a Required Field ===== 
  
 The markup for required fields is as simple as can be: The markup for required fields is as simple as can be:
Line 638: Line 645:
     <h2> Visitor's Feedback </h2>     <h2> Visitor's Feedback </h2>
     <hr />     <hr />
-    <form action="/cgi-bin/echo_form.cgi" method="post">+    <form action="/cgi-bin/echo_params.cgi" method="post">
       <p>       <p>
         <label for="yourName">Your Name:</label>         <label for="yourName">Your Name:</label>
Line 695: Line 702:
     <h2> Visitor's Feedback </h2>     <h2> Visitor's Feedback </h2>
     <hr />     <hr />
-    <form action="/cgi-bin/echo_form.cgi" method="post">+    <form action="/cgi-bin/echo_params.cgi" method="post">
       <p>       <p>
         <label for="yourName">Your Name:</label>         <label for="yourName">Your Name:</label>
Line 752: Line 759:
     <h2> Welcome to Millennium Gymnastics Booster Club Popcorn Sales </h2>     <h2> Welcome to Millennium Gymnastics Booster Club Popcorn Sales </h2>
     <form action=     <form action=
-    "/cgi-bin/echo_form.cgi"+    "/cgi-bin/echo_params.cgi"
     method="post">     method="post">
       <!-- A borderless table of text widgets for name and address -->       <!-- A borderless table of text widgets for name and address -->
Line 852: Line 859:
   <body>   <body>
     <h2> Welcome to Millennium Gymnastics Booster Club Popcorn Sales </h2>     <h2> Welcome to Millennium Gymnastics Booster Club Popcorn Sales </h2>
-    <form action= +    <form action="/cgi-bin/echo_params.cgi" method="post">
-    "/cgi-bin/echo_form.cgi" +
-    method="post">+
       <!-- A borderless table of text widgets for name and address -->       <!-- A borderless table of text widgets for name and address -->
       <table>       <table>
Line 939: Line 944:
 </html> </html>
 </code> </code>
-    <hr /> 
  
  
eg-259/lecture3.1359995749.txt.gz · Last modified: 2013/02/04 16:35 by eechris