Friday, August 22, 2008

How to Decide Whom to Call?


In the previous example, the phone number is hardcoded into the URL. This is not very convenient in many scenarios. For instance, you might want a drop-down list of local numbers to choose from, or you might want to be able to enter your own target numbers. With a little help from WML variables, you can easily make the call link dynamic. The following example shows a WML text entry box. You can enter any phone number in the box and then click the link below it to make the call

Download here

In the example, the phoneno WML variable captures your input in the text box. Then its value, $(phoneno), is embedded in the phone call URL as the phone number. If you enter an incorrectly formatted phone number (e.g., alphabetic letters with numbers), the browser will throw an error when you try to make the call.

No comments: