Re: QuickForm basics

From: Date: Wed, 01 Oct 2003 15:13:16 +0000
Subject: Re: QuickForm basics
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8182@lists.php.net to get a copy of this message
HTML_QuickForm_Controller looks promising, but what I'm doing is pretty simple. I just want to know how to submit the form. This is probally a more simple question than people are used to. I'm using the examples included with quickforms, which of couse only submit to themselves. Below is the code I'm using. WHere do I put in this code where to submit the form too when it validated? The page I want to submit to is "client.php" and I've tried putting that in various places without getting it to work right. Thanks, Keith <?php require_once ("HTML/QuickForm.php"); $form = new HTML_QuickForm('frmTest','get'); $form->addElement('header', '', 'Enter DSI Count Number'); $form->addElement('text', 'dsino', 'DSI Job #:'); $form->addElement('text', 'partno', 'Part #:'); $buttons[] = &HTML_QuickForm::createElement('submit', '', 'Submit'); $form->addGroup($buttons); // applies new filters to the element values $form->addRule('dsino', 'You need to enter a count number dummy', 'required'); // Tries to validate the form if ($form->validate()) { // Form is validated, then processes the data $form->freeze(); $form->process('myProcess', false); echo "\n<HR>\n"; } // Process callback function myProcess($values) { echo '<pre>'; var_dump($values); echo '</pre>'; } $form->display(); ?> Bertrand Mansion wrote:
<keith@setuplinux.com> wrote :
Hi all, I'm using quickforms wich is pretty slick I must say but I had a couple newbie questions with it. Basically I have my initall quickform page, and I want to submit to a second quickform page. Here is the questions I have 1) how can I have the form do is checks then submit to the next page after error checking? Right now I can only seem to get it to do one or the other. new HTML_QuickForm('frmTest','get'); $buttons[] = &HTML_QuickForm::createElement('submit', 'client.php', 'Submit'); Above is what i"m using now from one of the examples included with QuickForms. I want the form to submit to client.php after it checks the "addRule" stuff. 2) When I do get the form to submit to the next quickform page, I need to do a db query based on the results from the first page and populate the form with the db values. But I get a results type section, I don't get forms that are editable. Not sure what I need to do to make sure this page is always editable.
You can give the HTML_QuickForm_Controller a try. You can also try to add a hidden field in your form and check if its value is set just before calling $form->validate() (in the same conditional if). Bertrand Mansion Mamasam


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