Re: HTML_QuickForm_Controller and setDefaults
| From: | Kim Fredenberg | Date: | Thu, 14 Sep 2006 05:44:07 +0000 |
| Subject: | Re: HTML_QuickForm_Controller and setDefaults | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25133@lists.php.net to get a copy of this message | ||
Alexey Borzov wrote:
>> Now I am happy, it works like a charm :)
>
>
> Seems like this change will indeed fix the problem, though I need to
> check whether it can also break something else. :]
I think it will not break anything, the fact is that the _flagSubmitted
is reset back to true in loadValues and not used before that.
----------------------------
$page =& $this->_pages[$key];
$page->_flagSubmitted = false;
// Use controller's defaults and constants, if present
// _flagSubmitted should be false on a non-modal unseen page
// when calling applyDefaults
$this->applyDefaults($key);
$page->isFormBuilt() or $page->BuildForm();
// We use defaults and constants as if they were submitted
$data['values'][$key] = $page->exportValues();
$page->loadValues($data['values'][$key]);
----------------------------
So here _flagSubmitted is used only on applyDefaults (where false is
needed) and the next time in loadValues where it is reset to true, as it
probably should since we can assume that the page as been submitted once
the values are set?
Kim