decorative banner

Getting user input


    You can capture input from users with the following elements:

    • The input element creates a text entry field.
    • The fieldset element creates a grouping of text entry fields.
    • The select element creates a list of options from which a user can choose.
    • The option element adds a single option to a selection list.
    • The optgroup element groups options together in a selection list.

To create a text entry field:

  1. Drag the Input icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is in the desired location in a paragraph.
  2. In the Input Inspector, specify the name of the variable to set with the user's input in the name text box. (See Using variables.)
  3. Set the following optional attributes in the Input Inspector:
    • type to choose whether a user will enter text or a password. If you choose password, the WML browser can obscure the text while a user enters it, such as displaying asterisks in place of characters.
    • emptyok to choose whether or not the user is required to enter text in the input area. If you choose false, the user must enter text before continuing.
    • size to specify the width, in characters on the input area. Some browsers may ignore this attribute.
    • maxlength to specify the maximum number of characters that a user can enter in the input area. To allow an unlimited number of characters, leave this attribute blank.
    • tabindex to specify the position of the element in the tabbing order (the order in which elements are activated when a user presses the tab key). Enter 1 if you want the element to be first in the tabbing order. Some browsers may ignore this attribute.
    • xml:lang to specify the language of the element or its attributes.
    • value to specify the default value of the variable specified in the name attribute.
    • format to specify the range of characters that a user can enter.
    • title to specify a title for the element.
    • accesskey to specify a key that a user can press to activate the input area. The availability of keys depends on the wireless device. For example, phones have 1 through 9 keys and a pound key. Some browsers may ignore this attribute.

To create a group of text entry fields:

  1. Drag the Fieldset icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is in the desired location in a paragraph.
  2. Set the following optional attributes in the Fieldset Inspector:
    • title to specify a title for the element.
    • xml:lang to specify the language of the element or its attributes.
  3. Add input elements to the fieldset element.

To create a selection list:

  1. Drag the Select icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is in the desired location in a paragraph.
  2. Set the following optional attributes in the Select Inspector:
    • name to specify the name of the variable to set with the result of the selection (as determined by the value attribute of the option element). (See Using variables.)
    • multiple to specify whether or not the user can make multiple selections.
    • tabindex to specify the position of the element in the tabbing order (the order in which elements are activated when a user presses the tab key). Enter 1 if you want the element to be first in the tabbing order. Some browsers may ignore this attribute.
    • title to specify a title for the element.
    • value to specify the default value of the variable named in the name attribute.
    • iname to specify the name of the variable to set with the index result of the selection. The first option in the list has an index value of 1, the second option in the list has an index value of 2, and so on. If the user does not select an option, the variable is set to 0.
    • xml:lang to specify the language of the element or its attributes.
    • ivalue to specify a default index value to be used if the variable specified in the iname attribute is not set when the element is displayed.

To add options to a selection list:

  1. Drag the Option icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is over the colored area of a select element.
  2. Enter text for the option in the white area of the option element.
  3. Set the following optional attributes in the Option Inspector:
    • title to specify a title for the element.
    • value to specify the value with which to populate the select element's name variable if a user selects the option.
    • xml:lang to specify the language of the element or its attributes.

To create a group of options in a selection list:

  1. Drag the Optgroup icon from the WML Elements set in the Objects palette into the document window. Release the mouse button when the pointer is over the colored area of a select element.
  2. Set the following optional attributes in the Optgroup Inspector:
    • title to specify a title for the element.
    • xml:lang to specify the language of the element or its attributes.
  3. Add option elements to the optgroup element.