|
Step 4: Creating a Form
Either instantiate a form object and start adding fields:
<?php
/* Create Horde_Form object. */ $form = &new Horde_Form($vars, 'Form Title', 'form_name');
/* Add form fields. */ $form->addVariable(_("Title"), 'title', 'text', true); $form->addVariable(_("Interpret"), 'interpret', 'text', true); $form->addVariable(_("Album"), 'album', 'text', true); $form->addVariable(_("MP3 file"), 'file', 'file', true);
?>
Or extend the form class:
<?php
class MP3_Form extends Horde_Form {
function MP3_Form(&$vars, $title = '') { /* Call the parent constructor. */ parent::Horde_Form($vars, $title, 'mp3_form');
/* Add form fields. */ /* $this->addVariable(<Human Name>, <Field Name>, <Field Type>, <Required?>); */ $this->addVariable(_("Title"), 'title', 'text', true); $this->addVariable(_("Interpret"), 'interpret', 'text', true); $this->addVariable(_("Album"), 'album', 'text', true); $this->addVariable(_("MP3 file"), 'file', 'file', true); }
}
?>
|