csu - dce 0791 - webmaster i html - forms - fort collins, co copyright © xtr systems, llc designing...

6
CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Form Instructor: Joseph DiVerdi, Ph.D.

Upload: gloria-norris

Post on 31-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

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.

Page 2: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

CSU - DCE 0791 - Webmaster IHTML - Forms - Fort Collins, CO

Copyright © XTR Systems, LLC

An Example Form

Page 3: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

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>

Page 4: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

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

Page 5: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

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

Page 6: CSU - DCE 0791 - Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:

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