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.
Feedback Form (ExpandCollapse)
|
|