Home arrow Design Usability arrow Page 3 - Using HTML_QuickForm To Manage Web Forms, Part 1
DESIGN USABILITY

Using HTML_QuickForm To Manage Web Forms, Part 1


Tired of authoring dull and dreary Web forms everyday? Fed up of programming JavaScript validations day-in and day-out? Then, the HTML_QuickForm package is just the solution for which you are looking. In the first part of this two-part tutorial, I'll get you started with the basics of building Web forms using this resourceful PEAR package.

Author Info:
By: Harish Kamath
Rating: 5 stars5 stars5 stars5 stars5 stars / 73
December 22, 2004
TABLE OF CONTENTS:
  1. · Using HTML_QuickForm To Manage Web Forms, Part 1
  2. · Installing The HTML_QuickForm Package
  3. · My First HTML_QuickForm
  4. · FORM Elements
  5. · Adding Standard HMTL FORM Elements
  6. · Defining FORM Controls, Submitting Data
  7. · Grouping
  8. · "Checkbox" and "Radio" Elements
  9. · Drop Down Control and Hidden Element
  10. · Implementing Form Validations
  11. · Password Field Validation
  12. · Processing Data With HTML_QuickForm
  13. · Conclusion

print this article
SEARCH DEVARTICLES

Using HTML_QuickForm To Manage Web Forms, Part 1 - My First HTML_QuickForm
(Page 3 of 13 )

As you might have guessed, the aim of this article is to demonstrate the ease with which one can generate a Web form using the HTML_QuickForm package. Click on the link below to view the code listing for my first Web form:

Code Listing 1

Load this example in the browser to view the following output:

Using_HTML_QuickForm

A quick review of the code and you will see that I have not hard-coded any <FORM> elements - yet, the browser displays a neat little Web form when the script is loaded. At this point, I can safely conclude that this package definitely fulfills one of my original goals: I should not be required to type any HTML code during development.

Now it's time to dissect the code listing. For starters, I have to "require" PHP file that contains the definition of the HTML_QuickForm() class as shown below:

<?php

// include the required PEAR class
require_once 'HTML/QuickForm.php';

// define a new HTML_QuickForm object
$obj_registration_form = new HTML_QuickForm('frmRegistration');

// snip

?>
 

Moving to the next statement - I have created a new instance (called "$obj_registration_form") of the HTML_QuickForm() class. The constructor of this class has one compulsory parameter - the name of the Web form. The rest of the input parameters are optional; among other things, these optional parameters allow me to specify values for the different attributes associated with the <FORM> HTML element.

Note that the default value of the "method" attribute is "POST" the above Web form. So, if I wish to use the "GET" method, I need to pass this value explicitly to the constructor.


blog comments powered by Disqus
DESIGN USABILITY ARTICLES

- Responsive Web Design: More Than Just a Buzz...
- Add New Website Features to Please Users
- Gzip Components in Action
- Configuring Gzip Components
- Gzip Components
- 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

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials