#23746 [Csd->Fbk]: Default values do not work when $_POST is set
| From: | mansion@php.net | Date: | Fri, 23 May 2003 09:35:31 +0000 |
| Subject: | #23746 [Csd->Fbk]: Default values do not work when $_POST is set | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16636@lists.php.net to get a copy of this message | ||
ID: 23746
Updated by: mansion@php.net
Reported By: nlenz at ivcf dot org
-Status: Closed
+Status: Feedback
Bug Type: PEAR related
Operating System: Linux
PHP Version: 4.3.1
Assigned To: mansion
New Comment:
!== was used in CVS.
But Alexey Borzov told me he had a better idea so wait and see.
Previous Comments:
------------------------------------------------------------------------
[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