Quickform

From: Date: Tue, 03 Feb 2004 22:39:49 +0000
Subject: Quickform
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10503@lists.php.net to get a copy of this message
Hello, I just began a very nice project using as much PEAR packages as possible. Another objective is to make as many classes as possible. My question is how I can build a good form using quickform. I already have a working form, however the problem for which I can't find a good solution is the following. I have a form were users type in some data. here is the code: ----------------------------------------------------------------------- <?php require_once "HTML/QuickForm.php"; require_once "hfs_fetch_news.php"; $textAreaAttr = array ("rows"=>"10", "cols"=>"50", "wrap"=>"soft"); $form = new HTML_QuickForm ('new message'); $form->addElement('header', 'header', 'Voer een nieuws bericht in.'); $form->addElement('text', 'nieuws_kop', 'Nieuwskop: '); $form->addElement('textArea', 'nieuws_tekst', 'Nieuwstekst', $textAreaAttr); $form->addElement('text', 'nieuws_link', 'Verwijzing '); $form->addElement('text', 'nieuws_auteur', 'Auteur: '); $form->addElement('submit','submit','submit'); $form->applyFilter('__ALL__', 'htmlspecialchars'); $form->applyFilter('__ALL__', 'trim'); $form->addRule('nieuws_kop', 'Nieuwskop is verplicht', 'required'); $form->addRule('nieuws_tekst', 'Nieuwstekst is verplicht', 'required'); $form->addRule('nieuws_link', 'Nieuwslink is verplicht', 'required'); $form->addRule('nieuws_auteur', 'Nieuwsauteur is verplicht', 'required'); if ($form->validate()) { $form->freeze(); $form->process('processData', false); } else { $form->display(); } function processData ($values) { $myClass = new news(); $myClass->setHeader($values['nieuws_kop']); $myClass->setBody($values['nieuws_tekst']); $myClass->setLink($values['nieuws_link']); $myClass->setAuthor($values['nieuws_auteur']); } ?> ---------------------------------------------------------------------------- Now the function processData() instantiates a new class and set some members. Okay all good. Now I want to take the user to a confirmation and if they are okay with, some action will be taken. But how do I do that? How can I build either a new form on the same page, or take them to another form? Thanks, Thijs

« previous php.pear.general (#10503) next »