Description
Form items allow you to place different types of form items into your form.
Quick Example
..snip..- <form>
- <action>http://my-domain/location.htm</action>
<formItem item_type="text">
<name>s</name>
</formItem>
<formItem item_type="submit">
<name>Search</name>
</formItem>
- </form>
- </cell>
..snip..
Attributes
class
Specify a class for your form item so that you can use a style sheet to change the way it looks.
Example:
<formItem class="formItemClass">
<url>http://your-domain.com/file1.xml</url>
</formItem>
item_type
Defines the type of form element.
Options:
| Value | Usage |
|---|
| text | Renders a text input field |
| password | Renders a password input field |
| submit | Submit button for the form |
| textarea | Multiline text entry element |
| checkbox | Checkbox form field |
| file | Render a file upload field |
| select | Dropdown menu |
| hidden | Hidden form field |
| title | Adds some text to the form without creating any control elements |
| menuselector | Series of radio buttons populated by the menu created in
Canvas™ |
| menudrop | Select element with values populated by the menu created in
Canvas™ |
Example:
<formItem item_type="text">
<url>http://your-domain.com/file1.xml</url>
</formItem>
menu_id
Use a menu created within Wapple Canvas™ as the source data for a "menuselector" or "menudrop" form item. This attribute will only accept menu ids created in Wapple Canvas.
Example:
<formItem item_type="menuselector" menu_id="12345">
</formItem>
Child Elements
label
The label associated with your form item. This might describe what the form item actually is asking the end user.
Example:
<formItem item_type="text">
<label>My Form Label</label>
</formItem>
Nb. If the item_type is "submit", the
<label> element will appear as the value inside the button.
name
The name of the variable associated with the form item and its resulting _POST. The name defined here will be used when the value is posted to your processing script.
Example:
<formItem item_type="text">
<name>name</name>
</formItem>
value
A pre-populated value for the form item. This can be used as the text on a submit button, and a default value for select and checkbox items (0 or 1 for checkboxes).
Example:
<formItem item_type="text">
<value>a default value</value>
</formItem>
possibility
When using an item_type of "select", you can specify your options to appear in the drop down list by using a
<possibility> element. To specify more than 1 option, list the possibilities underneath each other.
Example:
<formItem item_type="select">
<possibility>
<label>Option 1</label>
<value>1</value>
</possibility>
<possibility>
<label>Option 2</label>
<value>2</value>
</possibility>
</formItem>
input_mask
Set the default character input mode for a form item. You can choose whether the input accepts only numbers or alpha charcaters. This method uses the Wap-Input-Mask attribute.
Possible Values:
*A = Uppercase letters and symbolic
*a = Lowercase letters and symbolic
*N = Numbers only
n*N = Optional symbol then numbers only
Example:
<formItem item_type="text">
<name>ID</name>
<input_mask>*N</input_mask>
</formItem>
maxlength
Set the max number of characters to enter in an input field
Example:
<formItem item_type="text">
<name>ID</name>
<maxlength>2</maxlength>
</formItem>
Detailed Example
..snip..- <form>
- <action>http://my-domain/location.htm</action>
<formItem item_type="hidden">
<name>hidden_field</name>
<value>xyz</value>
</formItem>
<formItem item_type="select">
<name>select_field</name>
<possibility>
<label>Option 1</label>
<value>1</value>
</possibility>
<possibility>
<label>Option 2</label>
<value>2</value>
</possibility>
</formItem>
<formItem item_type="text">
<name>ID</name>
<value></value>
<input_mask>*N</input_mask>
<maxlength>2</maxlength>
</formItem>
<formItem item_type="file">
<label>Upload a file</label>
<name>FILE</name>
</formItem>
<formItem item_type="checkbox">
<name>check</name>
<value>1</value>
</formItem>
<formItem item_type="textarea">
<name>text</name>
<value>Please enter your text...</value>
</formItem>
<formItem item_type="password">
<name>pass</name>
- <value></value>
..snip..