SWEET: Small Wind Energy Economic Tool// Instantiate the HTML_QuickForm object $form = new HTML_QuickForm('firstForm'); // Set defaults for the form elements //$form->setDefaults(array( // 'name' => 'Joe User' //)); // Add some elements to the form //$form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'firstname', 'First name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('text', 'lastname', 'Last name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('text', 'email', 'E-mail:', array('size' => 50, 'maxlength' => 255)); $form->addElement('static', '', ''); $form->addElement('advcheckbox', 'joinannounce', null, ' Join the CWEC announcements mailing list', null, null); $form->addElement('advcheckbox', 'joindiscuss', null, ' Join CWEC\'s small wind discussion mailing list', null, null); $form->addElement('static', '', ' '); //$form->addElement('reset', null, 'Clear form'); $form->addElement('submit', null, 'Go to SWEET!'); // Define filters and validation rules $form->applyFilter('firstname', 'trim'); $form->addRule('firstname', 'First name is required.', 'required', null); $form->applyFilter('lastname', 'trim'); $form->addRule('lastname', 'Last name is required.', 'required', null); $form->applyFilter('email', 'trim'); $form->addRule('email', 'E-mail address is required.', 'required', null); $form->addRule('email', 'E-mail address is required.', 'email', null); $form->addRule('email', 'A valid e-mail address is required.', 'email', null); // Try to validate a form if ($form->validate()) { $form->freeze(); $form->process('myProcess', false); echo << Please do not openly redistribute SWEET or the password for this site. Use the links immediately below to download SWEET. SWEET is part of the CWEC Small Wind Energy Systems course. If you haven't already, please consider attending the course for detailed information on the science and economics that go along with SWEET. SWEET Release History • 4 December 2006. SWEET v2.4 released. Added taxation of rebates. Minor interface changes. • 18 November 2006. SWEET v2.3 released. First public release. |