Page 148 - DCAP202_Fundamentals of Web Programming
P. 148
Unit 12: HTML Forms
12.1.1 HTML Form E-mail Notes
Generally, the button should be the last item of your form and have its name attribute set to
“Send” or “Submit”.
In addition to adding the submit button, we must also add a destination for this information and
specify how we want it to travel to that place. Adding the following attributes to your <form>will
do just this.
Method: We will only be using the post functionality of method, which sends the data without
displaying any of the information to the visitor.
Action: Specifies the URL to send the data to. We will be sending our information to a fake email
address.
Self Assessment
Fill in the blanks:
1. ................................. method sends the form information by including it on the URL.
2. ................................. method sends the form information in the HTTP environment.
3. ................................. attribute specifies the URL to send the data to.
12.2 Button
We use the <input> tag to create a basic button. Within the code, we use type=”button” to set the
control to a button.
Example:
<button type=”button” onclick=”JavaScript:alert(‘You liked that, didn\’t
you!’)”>Go ahead... make my day!</button>
Self Assessment
Fill in the blanks:
4. We use the .......................... tag to create a basic button.
5. Within the code, we use type=”.................................“ to set the control to a button.
12.3 Text
Text fields offer a small rectangular box that’s always ready to receive information from viewers.
Users will notice that when they click these fields, the cursor will change from the typical arrow
to a pipe character ( | ), allowing for text entries to be typed inside each input field.
12.3.1 TYPE Attribute
A text field is placed on a web page using the <input> tag, with the type attribute set with a value
of “text”.
<form name=”MyForm” action=”to:youremail@email.com” method=”post”>
LOVELY PROFESSIONAL UNIVERSITY 141