Before we can get into XForms code, we need to set up the environment. I assume you will have a tool to edit code (preferably with syntax highlighting and autocompletion), as well as a tool to preview or publish XForms documents. The Smartsite XForms Workbench is a great tool because it combines the two while offering great inspection and debugging aids. Another excellent tool is the Orbeon Forms Designer.
As an XForms definition is generally embedded in an HTML (be it HTML4, HTML5 or XHTML) context, we will start with creating the surrounding environment: an XML document containing a number of important namespaces and some HTML code in it.
<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title> </title> </head> <body> <h1>Events Application Form</h1> </body> </html>