From Wikibooks, open books for an open world
Jump to navigation Jump to search

Here is a simple address form. Note that HTML is the default namespace. We interleave both XForms and HTML tags but the XForms tags have xf as a prefix. We use the HTML fieldset and legend tags to put related form elements in a group. We use the XForms group element to tell us where in the model to get our instance data.

Link to XForms Application[edit | edit source]

Load XForms Application

Program[edit | edit source]

      <title>Address Form</title>
            <Address xmlns="">
               <LocationStreetFullText />
               <LocationCityName />
               <LocationStateName />
               <LocationPostalID />
      <xf:group ref="/Address">
            <legend>Mailing Address</legend>
            <xf:input ref="LocationStreetFullText">
               <xf:label>Street: </xf:label>
            <br />
            <xf:input ref="LocationCityName">
            <br />
            <xf:input ref="LocationStateName">
            <br />
            <xf:input ref="LocationPostalID">
               <xf:label>Postal Code:</xf:label>

Discussion[edit | edit source]

The form labels are not lined up very nicely. This can be done by adding a few lines of cascading style sheet to the program.

Note that the data uses an upper camel case naming convention used in ebXML, ACORD, UBL, GMXDM, NIEM and other US federal naming and design conventions.

Next Page: Address Aligned | Previous Page: Input
Home: XForms