|
|
 |
HTML Tutorial
What are Form Components?
Form components are what make the forms appear on the browser. For example, the
little box you fill in is a form component, just like a drop down box or a radio
button. We won't have time to discuss all the form components, but we will go
into a lot of them. Forms help make your site friendlier for the view to
communicate with you, people would rather use a form to fill out than an email,
because forms asks specific questions and really don't make the viewer think
about writing a letter.
Here is a listing of basic form components:
Must begin with:
<form action="/mail.pl" method="POST" name="Form"> action - is a URL that
defines where to send the data when the submit button is pushed.
method - can either be GET or POST. GET sends the form contents in the
URL: URL?name=value&name=value. Note: If the form values contains non-ASCII
characters or exceeds 100 characters you MUST use method="post". POST
sends the form contents in the body of the request. Note: Most browsers are
unable to bookmark post requests.
name - is the name of the form.
<input type="hidden" name="Email" value="Email">
<input type="hidden" name="subject" value="Subject">
<input type="hidden" name="url" value="url page">
For this particular form we have to add the above hidden input fields to make
our form work.
To create a Textbox:
<input type="text" name="T1" size="20" value="Your Name">
To create a Dropdown box:
<select name="dropbox">
<option value="1" selected>choice # 1</option>
<option value="2">another choice</option>
</select>
The option value is sent when the form is submitted.
The option selected, means that the option will show as selected unless changed.
To create a Checkbox (can select more than one):
<input type="checkbox" name="checkbox" value="ON" style="border-color:#FFFFFF;"
checked>
<input type="checkbox" name="checkbox" value="OFF"
style="border-color:#ffffff;">
The value will be sent for that checkbox, the "checked" means that it is
selected.
The style="border-color:#ffffff;" makes the border around the box the same color
as the background, which is white.
To create a Radio Button (can only select one):
<input type="radio" value="Over" name="radio" style="border-color:#ffffff;"
checked>
<input type="radio" value="Under" name="radio" style="border-color:#ffffff;">
The value will be sent for that radio box, the "checked" means that it is
selected.
The style="border-color:#ffffff;" makes the border around the box the same color
as the background, which is white.
To create a Textarea:
<textarea rows="2" cols="30" name="comment">Your letter</textarea>
To create a Password Box (will hide the password):
<input type="password" name="password">
To create Submit and Reset Buttons:
<input type="submit" value="Submit" name="B1" style="cursor:hand;"> <input
type="reset" value="Reset" name="B2" style="cursor:hand;">
Must end with:
</form>
 |
 |
|
|
|
|