In the example given below, we will build an simple WML card that do ask the user to
input the social security number (which is an identification number used by U.S.
A D V E R T I S E M E N T
Social Security Administration). We will then use the WMLScript to verify whether the
users input is formatted correctly. Following this verification, we will alert the
user by the WMLScript to let them know whether their number was been accepted or not.
This example represents the typical usage of a WMLScript on the client.
To build this, we will create a normal WML file containing the two cards: input card
and the results card (see the code 1 below). Accepting input will result in the
validateSSN() function which is being called. Note here that this function is stored in
the separate .wmls file and is declared within this file using the keyword extern.
The extern allows a function to be called by another functions or the WML events that
do exist outside the functions source file. To keep the function "private", simply
declare that function without using the keyword extern .