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

 
Developer Updates  
Free Website Content 
 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? 
Google.com  
XML

XForms Basics
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 41
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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

    - Flex Array Collection Sort and Filtering
    - The Flex Tree Control
    - Flex List Controls
    - Working with Flex and Datagrids
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek