Page 127 - DCAP512_WAP_AND_WML
P. 127

Unit 9: Working with user Input




                                                                                                Notes
                 Example: In the example below, the result is a selectable list where the user can select
          more than one item:
          <?xml version=”1.0"?>
          <!DOCTYPE wml PUBLIC “-//WAPFORUM//DTD WML 1.1//EN”
          “http://www.wapforum.org/DTD/wml_1.1.xml”>

          <wml>
          <card title=”Selectable List 2">
          <p>
          <select multiple=”true”>

          <option value=”htm”>HTML Tutorial</option>
          <option value=”xml”>XML Tutorial</option>
          <option value=”wap”>WAP Tutorial</option>
          </select>

          </p>
          </card>
          </wml>

          9.3.1 Restricted Input with Select

          The <select> selection lists gives users a choice of several predetermined answers in the forms of
          radio buttons or check boxes. Attributes are presented in Table 9.3.
                                            Table  9.3


             Attribute       Purpose
             Multiple        True or False, default is “false”
             Name            Variable name
             Value           The initial value, if any
             Iname and ivalue   The ‘iname’ is similar to the ‘name’ attribute. However, the variable defined
                             stores the index value(s) associated with the option(s) by the user. The index
                             value is derived from the position of the <option> element list, starting from
                             1. If no option is selected, the value is 0.
             Tabindex        This is used for putting the selection into a table order.

          9.3.2 The <option> Element

          The <option> attributes are presented in Table 9.4.

                                            Table  9.4

                 Attributes               Purpose
                 Value                    Sets the value of variable once chosen.
                 Onpick                   Designates a URL to go to, if chosen



                                           LOVELY PROFESSIONAL UNIVERSITY                                   121
   122   123   124   125   126   127   128   129   130   131   132