20.1.2. Using Data Collection Tags <select> and <input/>
Another way to set a value to a variable is to make use of data collection tags <select> and <input/>. Both <select> and <input> contain the name attribute, which specifies the name of the variable you want to assign a value to.
The following WML example shows how to assign a value to a variable using the <select> tag:
<select
name="selection_list">
<option
value="tutorial_A">WML Tutorial A</option>
<option
value="tutorial_B">WML Tutorial B</option>
<option
value="tutorial_C">WML Tutorial C</option>
</select>
In the above WML example, the variable associated to the selection list is named as selection_list. If a user selects the first option (i.e. WML Tutorial A), the value attribute value of the first option (i.e. tutorial_A) will be assigned to the selection_list variable.
The following WML example shows how to assign a value to a variable using the <input/> tag:
<input name="myName"/>
The variable associated to the above input field is named as myName. If a user types the word Jack in the input field, the myName variable will contain the value Jack.
Previous Page | Page 41 of 50 | Next Page |
- 1. WML (Wireless Markup Language) Introduction
- 2. WML Deck and Card
- 3. WML Document Structure
- 4. WML Generic Metadata: <meta>
- 5. Comments in WML
- 6. Line Breaking in WML
- 7. Font Size and Style in WML
- 8. WML Preformatted Text: <pre>
- 9. WML Images
- 10. WML Tables
- 11. WML Anchor Links
- 12. Programming Softkeys of Mobile Phones and the <do> Element
- 13. WML Template and Menu
- 14. WML Events and the <onevent> Tag
- 15. Timer and the ontimer Event
- 16. WML Event: onenterbackward
- 17. WML Event: onenterforward
- 18. WML Selection Lists and the onpick Event
- 19. WML Input Fields
- 20. WML Variables
- 21. Submitting Form Data to the Server in WML
- 22. Clearing a Saved Form in WML