Design Usability
  Home arrow Design Usability arrow Page 9 - 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  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
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 / 49
    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 - Drop Down Control and Hidden Element


    (Page 9 of 13 )

    <?php

    // snip

    // create a multiple select drop down
    $obj_registration_form->addElement('select', 'ddlLookingFor', 'Looking For:', array ("Publishing_Deal" => "Publishing Deal", "Label_Deal" => "Label Deal","Management_Deal" => "Management Deal", "Other" => "Other"), array("size" => "3", "multiple"));

    // snip

    // add a hidden value
    $obj_registration_form->addElement('hidden', 'txtReferrer', 'http://www.mysite.com');

    // snip

    ?>

    Next, I have added a multiple <SELECT> drop down control. This is pretty straightforward - just pass a value for the "size" attribute and the "multiple" keyword as elements of the array to the addElement() method.

    This is followed by the definition of a "hidden" element - for the sake of completeness.


    <?php

    // snip

    // creates a group of buttons to be displayed at the bottom of the form
    $obj_submit[] = &HTML_QuickForm::createElement('submit', 'btnSubmit', 'Register');
    $obj_submit[] = &HTML_QuickForm::createElement('reset', 'btnReset', 'Start Again');
    $obj_registration_form->addGroup($obj_submit, '', '', '&nbsp;&nbsp');

    // snip

    ?>

    Above, I have grouped the two "button" controls in order to display them on a single line - once again using the ubiquitous "grouping" concept.

    So far, I have manually added the different elements to a "group." However, the HTML_QuickForm() object also supports some controls that are "grouped" internally. The custom "date" element is one such example. This element is rendered by three drop down controls: one each for the day, month and year fields. The following statement will render an instance of the "date" element in a Web form:

    <?php

    // snip

    $obj_registration_form->addElement('date', 'txtDateOfBirth', 'Date of Birth:');

    // snip
    ?>

    That was pretty simple, wasn't it?

    Now, what’s next? Form validations, which is one concern that has yet to be addressed by the HTML_QuickForm() object. Not for long though,  as you shall soon see in the following section.

    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...
     

    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-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway