BODY: FORM

This document completes the description of remaining BODY tags:

FORM

This tag surrounds all of the form objects. It may not work properly within nested tables. Also, Newt's Cape attempts to associate labels for form objects: previous text for INPUT TEXT, PASSWORD, SELECT; following text for RADIO, CHECKBOX; you may need to experiment (and look at examples) for best results. To prevent label association, include an extra <P>.

Some interesting examples to try:

examples.htm#Forms
current Newt's Cape examples
search1.htm
for querying multiple search engines

Location: inside BODY

Attributes:

ACTION

defaults to BASE URL of document. specifies the action URI for the form. Starting with Newt's Cape 1.4, the same ACTION can be used in multiple forms (earlier, each had to be unique) and it keeps the data separate:

http:
sent to server address
mailto:
sent to email address
Notes
data formatted as text for Notes application
Print()
prints data frame to Inspector or terminal emulator (via Sloup or Newt's Cape)
NewtonScript method
passed data frame and other info
soup/soupname
written as a frame to a soup (and can be dumped later via Sloup)

ENCTYPE

default (application/x-www-form-urlencoded) is used; value currently ignored

Location: inside FORM

METHOD

specifies the method of accessing the action

values: GET, POST (default)

INPUT

An Input field. Attributes:

TYPE

Default: TEXT

TEXT

a single-line text entry field (though a long label may cause a multi-line input object). The first TEXT, PASSWORD or TEXTAREA field on a book page displays an insertion caret.

Required attributes: NAME

Optional attributes: VALUE, MAXLENGTH (supported); SIZE (unsupported). In the "single digit" example below with MAXLENGTH=1, only 1 character can be entered before system beeps.

Example:

<P>Flavor:<INPUT TYPE=TEXT NAME="FLAVOR0" VALUE="CHOCOLATE">

Result:

Flavor:

Starting with Newt's Cape 1.4, you can include an experimental VALUE_TYPE attribute to specify the type of value -- this may substitute a different user proto for example: a slider, A-to-Z picker, or date-and-time popup (defined earlier via META); provide different recognition defaults for handwriting; or just provide a different keyboard (numeric, date or phone) when double-tapped instead of the regular alphanumeric keyboard. Although this is non-standard, it appears as a regular TEXT field in other browsers (and possibly on older Newtons, depending on the user prototypes used). (advanced discussion and examples). There's also a link on the phone label. Some simple examples:

single digit date/time time phone fax name address city state province country

a slider in Newt's Cape (if NewtonScript compile was on):

PASSWORD

same as TEXT but input value is masked

Example:

<P>Password:<INPUT TYPE=PASSWORD NAME="PW">

Result:

Password:

HIDDEN

provides a hidden field, specifying a VALUE. We would recommend putting these at the beginning of the form so that the values are available to later fields (though they can appear later to set default values for earlier visible fields).

Required attributes: NAME, VALUE

Example:

<INPUT TYPE=HIDDEN NAME="XX" VALUE="yy">

Result:

CHECKBOX

boolean choice in n-of-many choice field

Required attributes: NAME, VALUE

Optional attributes: CHECKED

Example:

<P>What flavors do you like?
<P><INPUT TYPE=CHECKBOX NAME="FLAVOR1" VALUE="VANILLA">Vanilla
<P><INPUT TYPE=CHECKBOX NAME="FLAVOR1" VALUE="STRAWBERRY">Strawberry
<P><INPUT TYPE=CHECKBOX NAME="FLAVOR1" VALUE="CHOCOLATE" CHECKED>Chocolate

Result:

What flavors do you like?

Vanilla

Strawberry

Chocolate

Note: including an extra P for grouping enabled earlier versions of Newt's Cape to use the succeeding text string for the actual checkbox label (this is less necessary now). You can also include a link on a CHECKBOX label as in the preceding example above, e.g., <INPUT TYPE=CHECKBOX...><A HREF="#CHECKBOX">Chocolate</A>

RADIO

boolean choice in 1-of-many choice field

Required attributes: NAME, VALUE

Optional attributes: CHECKED

Example:

<P>Which is your favorite?
<P><INPUT TYPE=RADIO NAME="FLAVOR2" VALUE="VANILLA">Vanilla
<P><INPUT TYPE=RADIO NAME="FLAVOR2" VALUE="STRAWBERRY">Strawberry
<P><INPUT TYPE=RADIO NAME="FLAVOR2" VALUE="CHOCOLATE" CHECKED>Chocolate

Result:

Which is your favorite?

Vanilla

Strawberry

As for checkbox, you can include a link on a RADIO label, and a very long label may wrap to multiple lines. In 1.4, radio buttons can be non-contiguous, with other objects (e.g., text or input fields) interspersed vertically; or as adjacent table columns, though large sets of radio buttons may not split properly across book page boundaries.

Chocolate

IMAGE

displays an image, and allows x,y coordinate selection. This is like a combination of IMG and SUBMIT. This is used to support server-side image maps, i.e., the server processes the x,y coordinate and determines the result (for client-side image maps, see MAP and AREA). If the graphic is not present, Newt's Cape may replace this with a Submit button whose label defaults to "IMAGE:" and the NAME attribute, and which will send some dummy coordinatesin case a CGI script really expects some.

Required attributes: NAME, SRC

Optional attributes: ALIGN

Example:

<P>Tap on the picture
<P><INPUT TYPE=IMAGE NAME="COORD" SRC="inboxIcon">

Result:

Tap on the picture

SUBMIT

typically provides a button for submitting the form -- this will include any values that have been viewed or edited; it does not include unused Submit or Image fields in form data. Note: IMAGE also causes SUBMIT to occur. By default, the data remains after the SUBMIT (it is not automatically RESET).

Optional attributes: NAME (specifies a form field, whose value is VALUE), VALUE (label default: Submit). Button text isn't centered (BookMaker problem); border disappears in bordered TABLE cell.

Example (default submit):

<INPUT TYPE=SUBMIT>

Result:

Example (also setting an extra value):

<INPUT TYPE=SUBMIT NAME="SubmitField" VALUE="Submit1">
<INPUT TYPE=SUBMIT NAME="SubmitField" VALUE="Submit2">

Result:

BUTTON

this is treated the same as SUBMIT

RESET

typically provides a button to reset form fields to initial states

Optional attribute: VALUE (label default: Reset)

Example:

<INPUT TYPE=RESET>

Result:

SELECT

form field supplies a list of values. On 1.x, no more than ~24 items appear.

Location: inside FORM

MULTIPLE

indicates that more than one option may be included in the value.

NAME

name of the form field

LABEL

an optional attribute: the label that appears as part of the picker, to the left of the value. like some other input objects, this should automatically be obtained from left.

SIZE

specifies number of visible items. SIZE=1 is typically pop-down menus (implemented); SIZE>1 is a list (not implemented)

Example:

<P>Flavor
<SELECT NAME="FLAVOR3">
<OPTION>Vanilla
<OPTION>Strawberry
<OPTION VALUE="RumRaisin">Rum and Raisin
<OPTION SELECTED>Peach and Orange
<OPTION>
</SELECT>

Result:

Flavor

MULTIPLE example:

<P>Toppings
<SELECT NAME="TOPPINGS" MULTIPLE>
<OPTION>Oreo cookies
<OPTION>M&Ms
<OPTION SELECTED>Nuts
<OPTION>Fried ants</SELECT>

Result:

Toppings

OPTION

single choice within a SELECT element

Attributes: VALUE (defaults to content item), SELECTED (if item is initially selected; otherwise defaults to first item).

TEXTAREA

multi-line text field; if initial value is (or later becomes) too long for field or screen, it displays scroll arrows (and omits border due to clipping)

Attributes: NAME, ROWS (implemented); COLS (currently ignored)

Example:

<TEXTAREA NAME=ADDRESS ROWS=3 COLS=72>S. Weyer
102 Dillon Way
Washington Crossing, PA 18977</TEXTAREA>

Result:

For More Info

This document (in all its formats) is © 1995-2007. Steve Weyer, Greg Simon. All Rights Reserved Worldwide

Version 2.1. Last updated: Dec 2000