Design Usability
  Home arrow Design Usability arrow Page 7 - Using HTML_QuickForm To Manage Web Forms, ...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
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? 
DESIGN USABILITY

Using HTML_QuickForm To Manage Web Forms, Part 1
By: Harish Kamath
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 55
    2004-12-22

    Table of Contents:
  • Using HTML_QuickForm To Manage Web Forms, Part 1
  • Installing The HTML_QuickForm Package
  • My First HTML_QuickForm
  • FORM Elements
  • Adding Standard HMTL FORM Elements
  • Defining FORM Controls, Submitting Data
  • Grouping
  • "Checkbox" and "Radio" Elements
  • Drop Down Control and Hidden Element
  • Implementing Form Validations
  • Password Field Validation
  • Processing Data With HTML_QuickForm
  • Conclusion

  • 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


    Using HTML_QuickForm To Manage Web Forms, Part 1 - Grouping


    (Page 7 of 13 )

    This next example continues from where the first one left off. It will demonstrate the unique ability of the HTML_QuickForm() to "group" Web form controls together.

    Code Listing 2

    Load this example in your browser to see the following output:

    Using HTML_QuickForm

    While the above output does reflect the interface changes, it does not throw any light on the interesting concept of "grouping" Web form elements. To learn more about the latter, you will need to analyze the code behind the scenes. Take a look at the following code snippet:

    <?php

    // snip

    // Creates a group of text inputs
    $obj_first_name = &HTML_QuickForm::createElement('text', '', '', array('size' => 30, 'maxlength' => 30));
    $obj_last_name = &HTML_QuickForm::createElement('text', '', '', array('size' => 30, 'maxlength' => 30));
    $obj_registration_form->addGroup(array($obj_first_name, $obj_last_name), 'txtFullName', 'Full Name:', '&nbsp;');

    // snip

    ?>

    In the first example, I provided a single textbox for the "Full Name" field whereas most Web forms provide two text boxes, one each for the "First Name" and "Last Name" fields. This anomaly needs to be corrected. This is where the ability of the HTML_QuickForm() object to group <FORM> elements and treat them a single entity is useful.

    The "grouping" of the "First Name" and "Last Name" fields is one possible example. Another common example is a Web form field that accepts a credit card number. The user can be requested to enter it in groups of four numbers as embossed on the credit card itself.

    Coming back to the script, I have invoked the createElement() static method in order to create an instance of the HTML_QuickForm_element() object. The parameters of this static method mimic those of the addElement() method and the nature of element object created depends on the "keyword" value passed to the method.

    Once I have defined all the elements of a particular "group," I invoke the addGroup() method of the core HTML_QuickForm() object and pass an array, containing the element instances, along with a "name" and a "label" for the "grouped" control.

    The fourth parameter represents the separator used between the elements to be grouped - I have passed a non-breaking space entity character in order to display the two text fields on the same line.

    More Design Usability Articles
    More By Harish Kamath


       · When first time i saw this article i thought that it will solve all my problems that...
       · Then install the pear common package.
       · Great article! Where and how does the $ary_artist_info array get created in this...
     

    DESIGN USABILITY ARTICLES

    - Create Great JavaScript and CSS Menus Simply
    - Design Principles that Shape a Web Site
    - Creating Aqua Style Images
    - Easy as A,B,C – dynamic A to Z indexes
    - EasyChart: a Usability Teaching Tool to Demo...
    - Building Friendly Pop-up Windows
    - Back to School: Design Usability
    - Using HTML_QuickForm To Manage Web Forms, Pa...
    - Using HTML_QuickForm To Manage Web Forms, Pa...
    - More Website Knick Knack
    - Browsers as Test Platforms
    - Website Knick Knack
    - Dynamic Page Elements-Cloak and Dagger Web D...
    - Accessibility and Dreamweaver MX 2004







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