Home arrow Design Usability arrow Page 8 - Using HTML_QuickForm To Manage Web Forms, Part 1

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

Using HTML_QuickForm To Manage Web Forms, Part 1 - "Checkbox" and "Radio" Elements
(Page 8 of 13 )

Next, let me bring your attention to the other groupings that I have implemented in the example:


// snip

// create a checkbox group
$obj_genre[] = &HTML_QuickForm::createElement('checkbox', 'Alternative', null, 'Alternative');
$obj_genre[] = &HTML_QuickForm::createElement('checkbox', 'Hip-Hop', null, 'Hip-Hop');
$obj_genre[] = &HTML_QuickForm::createElement('checkbox', 'Other', null, 'Other');
$obj_registration_form->addGroup($obj_genre, 'chkGenre', 'Group Genre:', '<br />');

// create a radio button group
$obj_type[] = &HTML_QuickForm::createElement('radio', NULL, NULL, 'Male Solo', 'Male_Solo');
$obj_type[] = &HTML_QuickForm::createElement('radio', NULL, NULL, 'Female Solo', 'Female_Solo');
$obj_registration_form->addGroup($obj_type, 'radGroupType', 'Group Type:');

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


Here I have created a group of "checkbox" and "radio" <INPUT> elements using the createElement() static method. In this case, I have assigned the resultant element objects to an array. Next, I have passed this array of objects directly as input to the addGroup() method to render them in the browser. Note the use of a line break as a separator for the "checkbox" element - this displays each checkbox button on new line in the output.

blog comments powered by Disqus

- 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 

Developer Shed Affiliates


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