SunQuest
 
       Graphic Design
  Home arrow Graphic Design arrow Page 6 - Using HTML Quickform for Form Processing
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  
Actuate Whitepapers 
Moblin 
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? 
GRAPHIC DESIGN

Using HTML Quickform for Form Processing
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 147
    2004-09-01

    Table of Contents:
  • Using HTML Quickform for Form Processing
  • Steps for the Example
  • Individual Elements
  • Text, Password, Textarea
  • Hidden, Select
  • Checkbox, Radio
  • Submit, Reset, Button, Image
  • File, advcheckbox, Static
  • Header, Link, HTML
  • Element Groups
  • Processing Submitted Data
  • Without a Callback Function
  • Setting Validation Rules

  • 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

    AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th -1:00PM EST. Register Today!

    Using HTML Quickform for Form Processing - Checkbox, Radio


    (Page 6 of 13 )

    The checkbox element produces an HTML <input type="checkbox"> tag. The value attribute of this input tag is always set to 1.

    These are the valid arguments when creating a checkbox element:

    • $elementName: The name attribute of the element’s <input> tag

    • $elementLabel: The label of the element in the form

    • $text: The display text

    • $attributes: Arbitrary element attributes, as a string or an associative array It takes the following methods:

    • setChecked(): Sets the checked attribute, which causes a check to be displayed inside the checkbox

    • getChecked(): Gets the value of the checked attribute

    • setText(): Sets the display text printed to the right of the checkbox

    • getText(): Gets the display text printed to the right of the checkbox

    The following is the sample usage:

    $form->addElement('checkbox','redeye','Red Eye OK?',
             '(Check if a late night flight is acceptable.)');

    This is the sample HTML:

    <input name="redeye" type="checkbox" value="1" id="qf_ca4d9a" /> <label for="qf_ca4d9a"<(Check if a late night flight is acceptable.) </label>

    The for attribute of the <label< tag corresponds to the id attribute of the <input> tag. This ID value is generated internally by HTML_QuickForm.

    If a checkbox is left unchecked in a submitted form, then an element with the name of the checkbox isn’t defined at all in the array of submitted form variables. If the checkbox is checked, then the element with the same name as the checkbox has a value of 1 in the array of submitted form variables.

    radio

    The radio element produces an HTML <input type="radio"> tag. Radio buttons are like checkboxes, but if you put multiple radio buttons with the same name in one form, the browser only lets one radio button be selected at a time.

    These are the valid arguments when creating a radio element:

    • $elementName: The name attribute of the element’s <input> tag

    • $elementLabel: The label of the element in the form

    • $text: The display text

    • $value: The value attribute of the element’s <input> tag

    • $attributes: Arbitrary element attributes, as a string or an associative array

    The following is the sample usage:

    $form->addElement('radio','when','Departure:','Depart in the morning','morning');
    $form->addElement('radio','when',null,'Depart in the afternoon','afternoon');
    $form->addElement('radio','when',null,'Depart in the evening','evening');

    The following is the sample HTML:

    <tr>
    <td align="right" valign="top"><b>Departure:</b></td>
    <td valign="top" align="left"><input name="when" value="morning"
    type="radio" id="qf_27dde5" /><label for="qf_27dde5">Depart in the
    morning</label></td>
    </tr>
    <tr>
    <td align="right" valign="top"><b></b></td>
    <td valign="top" align="left"><input name="when" value="afternoon"
    type="radio" id="qf_2316ca" /><label for="qf_2316ca">Depart in the
    afternoon</label></td>
    </tr>
    <tr>
    <td align="right" valign="top"><b></b></td>
    <td valign="top" align="left"><input name="when" value="evening"
    type="radio" id="qf_f7bf3f" /><label for="qf_f7bf3f">Depart in the
    evening</label></td>
    </tr>

    Each radio button <input> element has the same name but a different value. If the user chooses the Depart in the morning radio button, then the value of the when element of the submitted form variable array is "morning". If the user chooses the Depart in the afternoon or Depart in the evening radio buttons, the value of the submitted form variable is afternoon or evening, respectively.

    This chapter is from Essential PHP Tools: Modules, Extensions, and Accelerators, by David Sklar, (Apress, 2004, ISBN: 1590592808). Check it out at your favorite bookstore today.

    Buy this book now.

    More Graphic Design Articles
    More By Apress Publishing


       · Any idea what version this comes in for the PEAR distribution?
       · If you follow the example code for uploading a file you may get frustrated that the...
       · Sorry,but I'd rather work in the old fashion way. You have much more control...
       · I think page 13 of the article, "Using HTML Quickform for Form Processing - Setting...
       · it's a really good tutorial. thank you again
       · Good intro, but you don't seem to have anything about setting default values, which...
       · Of course there is a method to set default values:e.g....
       · can you give me an example re: the client-side validation on custom rule.. the...
     

    GRAPHIC DESIGN ARTICLES

    - Building Corner Effects with Transparent Bac...
    - 3D Graphics Technology: VRML Part I - Introd...
    - Creating Visual Effects
    - Web Page Design Overview
    - Creating Artistic Photographs
    - Working with Tools in Paint Shop Pro 8
    - Using HTML Quickform for Form Processing
    - Introduction to Adobe FrameMaker
    - WebLogic Workshop, WebLogic Platform, and th...
    - Planning the Site
    - Working with Web Services
    - WebLogic Workshop Application Development Ba...
    - Scanning Images for Web Use
    - Web Graphics Overview
    - The Pen is Mightier than the Brush Tool







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway