RAP 2.1 Basic Forms


<form>

The <form> element acts as container for controls elements.

Contents

A combination of one element <input type=”submit”> and

  • one or more of the following elements: <input>, <select>, <br>, <p>
  • or one single <textarea> element

Attributes

attributes

values

(Default are bolded)

description

action

URL

Specifies a form processing agent. User agent behavior for a value other than an
HTTP URL is undefined. Refer to [5] for correct URL format.

method

get

Specifies the HTTP method used to send the form to the processing agent. Only get
method is supported in XHTML-GP.


<input>

The <input> element represents editable area

Contents

Empty

Attributes

attributes

values

(Default are bolded)

description

type

text
password
checkbox
radio
submit
hidden

Specifies the type of control to create.

name

text

Assigns name to the control. Not used for type=”submit”. Some names are reserved for Gigaset systems (see [5]).

value

text

Specifies the initial value of the control. Mandatory for type=”radio” and type=”checkbox”.

disabled

disabled

When set for a form control, this Boolean attribute disables the control for user input.

checked

checked

Specifies the state of a button. Valid for type=”radio” and type=”checkbox”.

inputmode

text
digits
dialpad

Specifies appropriate input mode for the text input expected in an associated input control.
Possible values means:

text: all available characters

digits: digits only: 0…9

dialpad: dial characters: 0…9 and #, *, P, R

maxlength

1..32

Specifies the maximum number of editable characters. Valid for type="text" and type="password"

Example:

<body>

<form action="http://host.com/adddata" method="get">

<p>text description</p>

<p>Text: <input type="text" name="input1" maxlength="12" value="default" /></p>
<p>Password: <input type="password" name="input2" maxlength="12" /></p>
<p>Checkmark <input type="checkbox" name="c1" checked="checked" value="check 1" /></p>
<p>Radio 1 <input type="radio" name="r1" checked="checked" value="option 1" /></p>
<p>Radio 2 <input type="radio" name="r1" value="option 2" /></p>
<p><input type="submit" value="Send"/></p>

</form>

</body>


<select>

The <select> element indicates list with options.

Contents

One or more of the following elements: <option>

Attributes

attributes

values

(Default are bolded)

description

disabled

disabled

When set for a form control, this boolean attribute disables the control for user input.

name

text

Assigns a name to the control.

Example:

<body>

<form action="http://host.com/adddata" method="get">

<p>Color:

<select name="colors">

<option value="1">red</option>

<option value="2" selected="selected">green</option>

<option value="3">blue</option>

</select>

</p>

<input type="submit" value="Submit"/>

</form>
</body>


<option>

The <option> element represents choice of menu created by <select>

Contents

One or more of the following elements: text

Attributes

attributes

values

(Default are bolded)

description

value

text

Specifies initial value to the control.

selected

selected

When set, this boolean attribute specifies that this option is pre-selected

.


<textarea>

Element allows the creation of a multiline text window for textual user input.

Contents

One or more of the following elements: text

Attributes

attributes

values

(Default are bolded)

description

name

text

An attribute used to assign a variable name to a form control. The name should be unique within the document

Example:

<body>

<form method="get" action="edit_result.jsp">
<textarea name="s1">
The quick brown fox jumps over the lazy dog.
</textarea>
<input type="submit" value="Search"/>
</form>

</body>