Monday, December 12, 2005

Quick HTML Form Field Overview

Forms are enclosed in form tags. Arguments to a form are action, method, and name.

Inside the form, the following types of fields can be placed:

textarea
Ex:

<textarea> value="hi" onClick="alert('test');" onChange="alert('changed');"
hi
</textarea>


textfield
<input type="textarea" value="hi" onClick="alert('test');" onChange="alert('changed');">


checkbox
<input type="checkbox" name="check1" id="check1" value="hi" onClick="alert('test');">
<input type="checkbox" name="check2" id="check2" value="hi" onClick="alert('test');" checked>


Use the word checked inside to have the default be checked.

radio
Radio buttons are a strange-- they are inputs with the same name but different ids.

Ex:
<input type="radio" name="radiogroup" id="radiogroup1" onClick="alert('selected #1');">
<input type="radio name="radiogroup" id="radiogroup2" onClick="alert('selected #2');" checked>


select
Selects can have multiple options selected. There are two types, the drop down and box with a list of values.

Drop down: (don't set a height)
<select name="select1" id="select1" onChange="alert('value may have changed');">
<option value="opt1">option number one</option>
<option value="opt2">option number two</option>
</select>


Box with a list: (set a size for the box, can also use the word multiple)
<select name="select1" id="select1" onChange="alert('value may have changed');" multiple size=3>
<option value="opt1">option number one</option>
<option value="opt2">option number two</option>
<option value="opt3">option number three</option>

hidden
Hidden fields are like textfields, except that they are invisible.

No comments:

Labels

Blog Archive

Contributors