XML
  Home arrow XML arrow Page 5 - XForms Basics
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

XForms Basics
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 38
    2004-01-12

    Table of Contents:
  • XForms Basics
  • Out with the Old...
  • ... In With the New
  • What's In A Name?
  • Welcome to Nowhere
  • A Tour of Nowhere

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    PCmover - $15 Off with Coupon Code CJPH7Q

    XForms Basics - Welcome to Nowhere
    (Page 5 of 6 )

    The previous example demonstrated two of the form controls available in XForms. However, there are lots more. Here's a brief list:

    1. <xforms:input>     
      A single-line text entry field.
    2. <xforms:secret>    
      A single-line text entry field which masks user input, good for passwords.
    3. <xforms:select>    
      A list field allowing multiple selection.
    4. <xforms:select1>   
      A list field allowing selection of only a single item from the list.
    5. <xforms:textarea>  
      A multi-line text entry field
    6. <xforms:upload>    
      A file upload field.
    7. <xforms:range>     
      A field which restricts entry to a range of values.
    8. <xforms:submit>    
      A form submission field.
    9. <xforms:output>    
      A field for displaying values from the instance data.

    In addition, the XForms specification also defines the following elements which may be attached to the controls above:

    1. <xforms:label>     
      Descriptive information for the corresponding control.
    2. <xforms:help>      
      Help information for the corresponding control.
    3. <xforms:hint>      
      Brief usage information for the corresponding control.

    Here's an example demonstrating some of them in action:


    <html xmlns=http://www.w3.org/1999/xhtml
    xmlns:xforms="http://www.w3.org/2002/xforms/cr">
     
    <
    head>
     
    <!-- 
    form model -->
    <
    xforms:model id="immigration">
     <
    xforms:instance src="immigration.xml" />
    </
    xforms:model>
    <
    basefont face="Arial">
     
    </
    head>
     
    <
    body>
     
    <!-- 
    define interface controls -->
    <
    table cellspacing="5" cellpadding="5" 
    border="0">
    <
    tr>
    <
    td colspan="2" align="center">
    <
    font color="red" size="4">
    Welcome to Immigration
    </font></td>
    </
    tr>
     
    <
    tr>
    <
    td>
     <
    xforms:input id="txtname" model="immigration" 
    ref="/immigrant/name">
      <
    xforms:label>Name</xforms:label>
      <
    xforms:hint>
      
    Enter your name here
      
    </xforms:hint>
     </
    xforms:input>
    </
    td>
    </
    tr>
     
    <
    tr>
    <
    td>
     <
    xforms:input id="txtcitizenship" model="immigration"
    ref="/immigrant/citizenship">
      <
    xforms:label>Citizenship</xforms:label>
      <
    xforms:hint>
      
    Enter your country of origin here
      
    </xforms:hint>
     </
    xforms:input>
    </
    td>
     
    </
    tr>
    <
    tr>
    <
    td align="left">
     <
    xforms:select1 model="immigration" 
     
    ref="/immigrant/purpose" appearance="full">
      <
    xforms:label>Purpose of visit</xforms:label>
      <
    xforms:hint>
      
    Please state the purpose of your visit
      
    </xforms:hint>
      <
    xforms:item>
       <
    xforms:label>Business</xforms:label>
       <
    xforms:value>B</xforms:value>
      </
    xforms:item>
      <
    xforms:item>
       <
    xforms:label>Pleasure</xforms:label>
       <
    xforms:value>P</xforms:value>
      </
    xforms:item>
      <
    xforms:item>
       <
    xforms:label>Other</xforms:label>
       <
    xforms:value>O</xforms:value>
      </
    xforms:item>
     </
    xforms:select1>
    </
    td>
    </
    tr>
     
    <
    tr>
    <
    td align="left">
     <
    xforms:select model="immigration" 
     
    ref="/immigrant/immunization" appearance="full">
      <
    xforms:label>Immunization</xforms:label>
      <
    xforms:hint>
      
    Please select the diseases that 
      you have been immunized against
      
    </xforms:hint>
      <
    xforms:item>
       <
    xforms:label>Smallpox</xforms:label>
       <
    xforms:value>100</xforms:value>
      </
    xforms:item>
      <
    xforms:item>
       <
    xforms:label>Malaria</xforms:label>
       <
    xforms:value>113</xforms:value>
      </
    xforms:item>
      <
    xforms:item>
       <
    xforms:label>Yellow fever</xforms:label>
       <
    xforms:value>56</xforms:value>
      </
    xforms:item>
      <
    xforms:item>
       <
    xforms:label>Typhoid</xforms:label>
       <
    xforms:value>174</xforms:value>
      </
    xforms:item>
     </
    xforms:select>
    </
    tr>
     
    <
    tr>
    <
    td align="left">
     <
    xforms:textarea model="immigration" 
     
    ref="/immigrant/address">
      <
    xforms:label>
      
    Address in home country
      
    </xforms:label>
     </
    xforms:textarea>
    </
    td>
    </
    tr>
    </
    table>
     
    </
    body>
    </
    html>

    More XML Articles
    More By Harish Kamath, (c) Melonfire


     

       

    XML ARTICLES

    - How to Set Up Podcasting and Vodcasting
    - Creating an RSS Reader Application
    - Building an RSS File
    - An Introduction to XUL Part 6
    - An Introduction to XUL Part 5
    - An Introduction to XUL Part 4
    - An Introduction to XUL Part 3
    - An Introduction to XUL Part 2
    - An Introduction to XUL Part 1
    - XML Matters: Practical XML Data Design and M...
    - Practical XML Data Design and Manipulation f...
    - SimpleXML
    - XForms Basics, Part 3
    - XForms Basics, Part 2
    - XForms Basics




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway