Controlling Whether Text Fields can be Left Empty (-wap-input-required Property)

Preferences - Do not show ads

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.

Page 28 of 39 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top

Feedback Form (Expand)

What do you think about this web page?

WCSS Tutorial Table of Contents WCSS Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page