QuickFormController : setDefaults() shows defferent result on checkbox element called by get/post

From: Date: Mon, 30 Aug 2004 03:01:53 +0000
Subject: QuickFormController : setDefaults() shows defferent result on checkbox element called by get/post
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14330@lists.php.net to get a copy of this message
Hi, in the code below, 'TEST by GET' bottun returns elements which are set by setDefaults(), but 'TEST by POST' bottun returns unchecked checkbox. Is this proper result ? I think both bottun must return checked checkbox. Why setDefaults() shows defferent result called by GET/POST ? regards. Nakamura ------- test.html --------- <html> <head> <title>QFCcheckbox TEST</title> </head> <body> <form action="QFCcheckbox.php" method="get"> <input type="submit" name="GETbtn" value="TEST by GET"> </form> <form action="QFCcheckbox.php" method="post"> <input type="submit" name="POSTbtn" value="TEST by POST"> </form> </body> </html> ------- end of test.html -------- ------- QFCcheckbox.php -------- <html> <head> <title>QFcheckbox TEST Result</title> </head> <body> <?php require_once '/usr/share/pear/HTML/QuickForm/Controller.php'; class checkboxForm extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $this->setDefaults( array('checkbox' => true, 'textbox' => 'default string') ); $this->addElement('checkbox', 'checkbox', 'checkbox', 'checked ?'); $this->addElement('text', 'textbox', 'textbox'); } } // main routine $page =& new HTML_QuickForm_Controller('form'); $page->addPage(new checkboxForm("TEST")); $page->run(); ?> </body> </html> ------- end of QFCcheckbox.php --------

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