WML documents

Creating your first WML page

WML documents don't look too different to any other XML file. It is advisable to keep all tags lowercase (XML does not mind as long as you are consistent, HTML doesn't even recognise case at all). Before you write your own WML documents, the next page will look at the various WAP Toolkits so that you can see what you have written.For now, we'll look at a simple, static, WML document.

<card id="main" title="Hello World">
<p>Hello World!</p>
<do type="prev" label="Back">

All the essential parts of the document are present: the DOCTYPE, the wml all-enclosing tag, one card (id and title attributes are required), some text and the most important - the do button which adds a Back button.

A WAP phone does not have to have any standard buttons or features. You must provide all navigation for all documents.

The do tag, and it's associated go child tag, are the basis of the interactive WAP document. Do provides the functionality, go provides a method of passing data collected from the user back to the server - in effect, go replaces the HTML tag FORM. Similar input controls can be achieved but there are significant differences in how the form operates, how data is entered, how the form is presented and how different phones interpret the tags. Although the resulting data is presented to the server in the same format as an HTML form, the server MUST respond in WML, so you will need to at least customise the Perl script dealing with the request to enable it to create a WML document for all output - including error messages. This will mean testing the script on a local server (e.g. intranet) before uploading an amended file. That's a job for a toolkit: . . . .

This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.