#23746 [Fbk->Csd]: Default values do not work when $_POST is set

From: Date: Fri, 23 May 2003 09:46:46 +0000
Subject: #23746 [Fbk->Csd]: Default values do not work when $_POST is set
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-16637@lists.php.net to get a copy of this message
ID: 23746 Updated by: avb@php.net Reported By: nlenz at ivcf dot org -Status: Feedback +Status: Closed Bug Type: PEAR related Operating System: Linux PHP Version: 4.3.1 Assigned To: mansion New Comment: The idea was related to fixing group.php for correct checkbox group behaviour, not to this bug. I think we can close this. Previous Comments: ------------------------------------------------------------------------ [2003-05-23 04:35:30] mansion@php.net !== was used in CVS. But Alexey Borzov told me he had a better idea so wait and see. ------------------------------------------------------------------------ [2003-05-22 17:58:57] nlenz at ivcf dot org The solution I proposed was wrong. If an empty string is submitted to a form, the form will keep the default value instead of using the empty string. !== should have been used instead of !=. ------------------------------------------------------------------------ [2003-05-22 04:45:53] mansion@php.net This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-05-21 18:49:49] nlenz at ivcf dot org Description of problem: 1. $_POST["someUnrelatedVar"] is set. 2. Create a QuickForm object using POST 3. Call setDefaults() 4. Default values will not show up, even though the element's name was not set in $_POST. Solution: In the element.php file, onQuickFormEvent method. Change: if (isset($caller->_submitValues) && count($caller->_submitValues) > 0) { To: if (isset($caller->_submitValues) && count($caller->_submitValues) > 0 && $this->_findValue($caller->_submitValues) != null) { ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23746&edit=1

« previous php.pear.dev (#16637) next »