See also: Forms Overview
The Form element is used to delimit a data input form. There can be several forms in a single document, but the Form element can not be nested. (I.e. a form can't contain another form)
<FORM ACTION="_URL_" METHOD="GET|POST" ENCTYPE="MIME
type">
. . .
</FORM>
The ACTION attribute is a
URL specifying the location to which the contents of the form data fields
are submitted to elicit a response. As mentioned before, this could be simply
a direction to an e-mail address, but generally, would be used to point towards
some kind of server based CGI script/application that handles the forwarding
of form data. If the ACTION
attribute is missing, the URL of
the document itself is assumed. The way data is submitted varies with the
access protocol of the URL to which the form data is sent and with the values
of the METHOD and ENCTYPE
attributes.
Generally, the METHOD
attribute specifies a method of accessing
the URL specified in the ACTION
attribute and will be either
GET or POST. The
GET
method is ideal for form submission where the use of the
form data does not require external processing. For example, with database
searches, there is no lasting effect caused by the query of the form (that
is, the query runs its search through the database and reports the results).
However, where the form is used to provide information for example, that
updates a database, then the POST
method should be used, with
the ACTION
attribute pointing to a CGI script that executes
the form data processing.
The ENCTYPE
specifies the media type used to encode the form
data. The default ENCTYPE
is the MIME type
'application/x-www-form-urlencoded'
The <FORM>
element can also accept
the TARGET attribute (as in
<A>
elements), to
specify what window is used for any form feedback. It can take the following
values :
<FRAME>
element, or
by using the
window.open
scripting method. If a window_name
is used which does not correlate
to a previously defined window, then a new window is created and
NAME
d according the the window name used in the
TARGET
attribute. This new window can then be referenced using
its new name.
<FRAMESET>
element
definitions that control the form's current window.
TARGET="window_name"
where the window_name used is not
a previously defined window. NOTE : Unlike using
the window_name
using a previously undefined window name, using
_blank
will not name the new window for future use.
the <FORM>
can also take the
NAME attribute, which can be
used to set the name of the element for scripting purposes.
TITLE="informational ToolTip"
The Internet Explorer 4.0 (and above) specific
TITLE
attribute is used for informational purposes. If present,
the value of the TITLE
attribute is presented as a ToolTip when
the users mouse hovers over the <FORM>
section.
LANG="language setting"
The LANG
attribute can be used to specify what language the
<FORM>
element is using. It accepts any valid ISO standard
language abbreviation (for example "en"
for English,
"de"
for German etc.) For more details, see the
Document
Localisation section for more details.
LANGUAGE="Scripting
language"
The LANGUAGE
attribute can be used to expressly specify which
scripting language Internet Explorer 4.0 uses to interpret
any scripting information used in the <FORM>
element.
It can accept values of vbscript
, vbs
,
javascript
or jscript
. The first two specify the
scripting language as Visual Basic Script, the latter two specify it as using
Javascript (the default scripting language used if no LANGUAGE
attribute is set.
CLASS="Style Sheet class
name"
The CLASS
attribute is used to specify the
<FORM>
element as using a particular style sheet class.
See the
Style
Sheets topic for details.
STYLE="In line style setting"
As well as using previously defined style sheet settings, the
<FORM>
element can have in-line stylings attached to it.
See the
Style
Sheets topic for details.
ID="Unique element identifier"
The ID
attribute can be used to either reference a unique style
sheet identifier, or to provide a unique name for the
<FORM>
element for scripting purposes. Any
<FORM>
element with an ID
attribute can be
directly manipulated in script by referencing its ID
attribute,
rather than working through the
All
collection to determine the element. See the
Scripting
introduction topic for more information.
Every <FORM>
element in a document
is an object that can be manipulated through scripting. Both
Netscape and Internet Explorer support
scripting of the <FORM>
object - Netscape
supporting it through the
Forms
collectionforms array, but Internet Explorer's
Dynamic
HTML support is more varied.
<FORM...>
Properties
The <FORM...>
element/object supports all of
the standard
Dynamic
HTML properties (i.e. className,
document, id,
innerHTML, innerText,
isTextEdit, lang,
language, offsetHeight,
offsetLeft, offsetParent,
offsetTop, offsetWidth,
outerHTML, outerText,
parentElement,
parentTextEdit,
sourceIndex, style,
tagName and title). Details
of these can be found in the
standard
Dynamic HTML properties topics.
The <FORM>
object also supports the following properties:
action, encoding,
method, name and
target, all of which directly reflect (or set)
their respective attribute values (with the encoding
property
reflecting the ENCTYPE
attribute)
<FORM...>
Methods
The <FORM...>
element/object supports all of
the standard
Dynamic
HTML methods (i.e. click,
contains, getAttribute,
insertAdjacentHTML,
insertAdjacentText,
removeAttribute,
scrollIntoView and
setAttribute). Details of these can be found in
the
standard
Dynamic HTML Methods topics.
The <FORM>
element also supports the
submit and reset methods,
which submit, or reset the form respectively.
<FORM...>
Events
The <FORM...>
element/object supports all of
the standard
Dynamic
HTML events (i.e. onclick,
ondblclick, ondragstart,
onfilterchange, onhelp,
onkeydown, onkeypress,
onkeyup, onmousedown,
onmousemove, onmouseout,
onmouseover, onmouseup
and onselectstart). Details of these can be found
in the
standard
Dynamic HTML events topics.
onreset and onsubmit
are also supported events of the <FORM>
element, firing
when the form is reset, or submitted respectively.
old:
© 1995-1998, Stephen Le Hunte
file: /Techref/language/html/ib/Forms/form.htm, 12KB, , updated: 2020/2/19 17:37, local time: 2024/11/25 07:09,
3.21.248.105:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/language/html/ib/Forms/form.htm"> <FORM></A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.