::HTML_QuickForm_Controller->exportValues()
| From: | Markus | Date: | Tue, 30 Sep 2003 19:35:22 +0000 |
| Subject: | ::HTML_QuickForm_Controller->exportValues() | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-22233@lists.php.net to get a copy of this message | ||
Hi!
Would be nice to have your opinion about this. Maybe it can be an
appropriate suggestion to the HTML_QuickForm_Controller-package team?
*Problem*
If you use the HTML_QuickForm_Controller package to build a multipage-form
and want two elements with the same name on two different pages, then the
exportValues() method in class HTML_QuickForm_Controller will only be able
to return an array with one of the values. This is because the array
returned is composed like:
array('element_name' => 'element_value')
*Solution*
I think it would be logic to return an array like:
array('page_name'=>array('element_name' => 'element_value'))
The original (relevant) code looks like this (file Controller.php):
405> foreach ($pages as $page) {
406> // skip elements representing actions
407> foreach ($data['values'][$page] as $key => $value) {
408> if (!preg_match('/^_qf_/', $key)) {
409> $values[$key] = $value;
410> }
411> }
412> }
413> return $values;
If changing line 409 an multidimensional arrya can be returned:
405> foreach ($pages as $page) {
406> // skip elements representing actions
407> foreach ($data['values'][$page] as $key => $value) {
408> if (!preg_match('/^_qf_/', $key)) {
409> $values[$page][$key] = $value;
410> }
411> }
412> }
413> return $values;
/Markus