csu - dce 0791 - webmaster i html - forms - fort collins, co copyright © xtr systems, llc designing...
TRANSCRIPT
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
Designing Web Sitesusing HTML -
Introduction to Forms
Instructor: Joseph DiVerdi, Ph.D.
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
An Example Form
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
Form HTML
<HTML>
<HEAD><TITLE>Ice Cream Survey</TITLE></HEAD>
<BODY>
<H1>Ice Cream Survey</H1>
<HR>
<FORM>
What is your favorite flavor of ice cream?
<P>
<INPUT TYPE="radio" NAME="ice cream" VALUE="vanilla" CHECKED>Vanilla<BR>
<INPUT TYPE="radio" NAME="ice cream" VALUE="strawberry">Strawberry<BR>
<INPUT TYPE="radio" NAME="ice cream" VALUE="chocolate">Chocolate<BR>
<INPUT TYPE="radio" NAME="ice cream" VALUE="other">Other<BR>
<P>
<INPUT TYPE="submit" VALUE="Submit your choice">
<INPUT TYPE="reset" VALUE="Clear your choice">
</FORM>
<HR>
If you would like to see the current results, click
<A HREF="/cgi-bin/pie.pl/ice_cream.dat">here</A>.
</BODY>
</HTML>
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
Form HTML (Continued)
• The previous script does nothing• An "action" is required• Normally a CGI script is used for the action
<FORM ACTION="/cgi/formmail.pl" METHOD=POST>
• We will examine this further when we study CGI and Perl Programming
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
Form HTML (Continued)
• Email can be used to collect Form data<FORM ACTION="mailto:[email protected]?
subject=Form Results" METHOD=POST ENCTYPE="text/plain">
• This will send an email message containing the form's contents in the following form:
ice cream=vanilla
CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO
Copyright © XTR Systems, LLC
Form HTML (Continued)
• No feedback to viewer - unacceptable• Here's a taste of JavaScript (Event Handler)
<FORM ACTION="mailto:[email protected]?subject=Form Results" METHOD=POST ENCTYPE="text/plain" onSubmit=window.alert('Form contents were sent via email')>
• A dialog box appears on the browser's window