18.2. Controlling Whether Text Fields can be Left Empty (-wap-input-required Property)
The -wap-input-required property helps you control whether a text field can be empty. This WCSS property should be applied to text fields, password fields or text area fields. There will be no effect if it is applied to other form controls. The -wap-input-required property either takes a true or false as the value. Here are two WAP CSS examples that demonstrate the usage of the -wap-input-required property:
-wap-input-required: true
Meaning: A user must enter some text in a text field with this WAP CSS style rule applied.
-wap-input-required: false
Meaning: A text field with this WAP CSS style rule applied accepts empty input.
Note that if both the -wap-input-required property and -wap-input-format property are specified to the same XHTML MP element and conflict occurs between the two styles, the -wap-input-required property takes precedence. For example, suppose some WCSS style rules are applied to a text field like this:
<input type="text" style='-wap-input-format: "N"; -wap-input-required: false'/>
The two WCSS styles in the above markup conflict with each other. The "-wap-input-format: "N"" WCSS style specifies that a single numeric character must be entered, but the "-wap-input-required: false" WCSS style states that the text field can be empty. In this case, the "-wap-input-required: false" WCSS style takes precedence. So, the text field can either be left empty or contain a single numeric character.
Here is another WAP CSS example:
<input type="text" style='-wap-input-format: "*M"; -wap-input-required: true'/>
The "-wap-input-format: "*M"" WCSS style states that the text field can contain any number of characters (i.e. having no character is valid). However, as the "-wap-input-required: true" WCSS style takes precedence, the text field must contain at least one character.
Previous Page | Page 28 of 39 | Next Page | ![]() |
- 1. WCSS (WAP CSS) Introduction
- 2. Wireless CSS and Wireless Profile CSS
- 3. Advantages of Using WAP CSS Style Sheets on Mobile Internet Sites
- 4. Disadvantages of Using WAP CSS Style Sheets on Mobile Internet Sites
- 5. Syntax Rules of WCSS
- 6. Comments in WCSS
- 7. How to Apply WCSS Styles to an XHTML MP Document
- 8. Different Types of Selectors
- 9. Div and Span Element of XHTML MP
- 10. Cascading Rules for Handling Multiple Groups of WCSS Styles Applied to the Same Element
- 11. Common Types of Property Value
- 12. WCSS Font and Text Properties
- 13. WCSS List Properties
- 14. WCSS Color Properties
- 15. WCSS Border Properties
- 16. WAP Specific Extensions to CSS
- 17. WCSS Access Key Extension
- 18. WCSS Input Extension
- 19. WCSS Marquee Extension
- 20. Matching WCSS Cascading Style Sheets to Different User Agents