NYCPHP Meetup

NYPHP.org

[nycphp-talk] PEAR: HTML_QuickForm

David Sklar sklar at sklar.com
Fri Apr 16 15:58:28 EDT 2004


Christopher R. Merlo wrote:
 >
> On 2004-04-16 15:22 -0400, David Sklar <sklar at sklar.com> wrote:
 >
>>$form = new HTML_QuickForm('myform','POST','/cgi-bin/phorm');
>>
>>This makes "/cgi-bin/phorm" the action of the form printed by 
>>$form->display().
> 
> That's a huge hint, especially considering how sparse the
> documentation is on the PEAR site.  Thanks, David.

No problem. Note that in the absence of documentation, the source code 
is the place to go. Sometimes that can be pretty hairy, but QuickForm is 
pretty good with its source comments. For example, the HTML_QuickForm 
class constructor (in QuickForm.php) starts out like this:

     // {{{ constructor

     /**
      * Class constructor
      * @param    string      $formName          Form's name.
      * @param    string      $method            (optional)Form's method 
defaults to 'POST'
      * @param    string      $action            (optional)Form's action
      * @param    string      $target            (optional)Form's target 
defaults to '_self'
      * @param    mixed       $attributes        (optional)Extra 
attributes for <form> tag
      * @param    bool        $trackSubmit       (optional)Whether to 
track if the form was submitted by adding a special hidden field
      * @access   public
      */
     function HTML_QuickForm($formName='', $method='post', $action='', 
$target='_self', $attributes=null, $trackSubmit = false)
     {

So you can sort of easily see what each argument does. Of course, you 
have to know that the constructor is where to look in the first place. 
It'd be much nicer to be able to look at pretty docs like PEAR DB has, 
but as hunting-through-source-code-to-see-how-something-works goes, 
QuickForm's not bad.

David




More information about the talk mailing list