PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm_Controller » Bug #4973

HTML_QuickForm_Page::exportValues returns internal values

Details

Request #4973HTML_QuickForm_Page::exportValues returns internal values
Submitted2005-08-02 16:46 UTC
Fromjameslee at cs dot nmt dot edu
Assignedavb
StatusClosed
PackageHTML_QuickForm_Controller
PHP Version4.3.11
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-08-02 16:46 UTC] jameslee at cs dot nmt dot edu

Description:
------------
HTML_QuickForm_Controller::exportValues() removes the internal values such as _qf_default; however, HTML_QuickForm_Page::exportValues() does not. Looking at the source, it appears that Page is inheriting exportValues from QuickForm, so overriding it with something similar to Controller's version might be the solution. This is an issue when one can not be sure of the contents of the form (for example, when using DB_Table to abstract field names) and must loop through the array returned by exportValues.

Test script:
---------------
class testPage extends HTML_QuickForm_Page {
function buildForm() {
$this->_formBuilt = TRUE;
$this->addElement('text','tester');
$this->addElement('submit',$this->getButtonName('next'),'Next');
$this->setDefaultAction('next');
}
}

class testAction extends HTML_QuickForm_Action {
function perform(&$page,$action) {
$page->isFormBuilt() or $page->buildForm();
print_r($page->exportValues());
}
}

Expected result:
----------------
Array
(
[tester] =>
)

Actual result:
--------------
Array
(
[tester] =>
[_qf_test_next] => Next
[_qf_default] => test:next
)