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 #5615

Checkbox problem after new release of QuickForm

Details

Submitted2005-10-06 09:46 UTC
Frombjartekv at gmail dot com
Assignedavb
StatusClosed
PackageHTML_QuickForm_Controller
PHP Version5.0.4
Roadmaps(Not assigned)

Comments

[2005-10-06 09:46 UTC] bjartekv at gmail dot com

Description:
------------
Checkbox values doesnt get checked when you load a previous page where you checked checkboxes. I suspect this happened after installing the latest Quickform release, which had this change.

* Other additions and fixes
- Added HTML_QuickForm::isSubmitted() method

I suspect this check to be the problem in HTML/QuickForm/checkbox.php function onQuickFormEvent($event, $arg, &$caller)
...

if ($caller->isSubmitted()) {
$value = $this->_findValue($caller->_submitValues);
} else {
$value = $this->_findValue($caller->_defaultValues);
}

I fixed this by extending HTML_QuickForm_Page and overriding the loadValues method like this:

function loadValues($values)
{
$this->_flagSubmitted = true;
parent::loadValues($values);
}

dunno if thats the best solution though.

Test script:
---------------
You can check this by running examples/tabbed.php which wont save the changes when you check some checkboxes.

[2006-04-21 13:54 UTC] igor dot grzalja at gmail dot com

The problem about extending loadValues to:
function loadValues($values)
{
$this->_flagSubmitted = true;
parent::loadValues($values);
}

results in unwanted behavior when using modeless controller (eg. tabbed.php). Problem is with required fields (eg. Recite a poem on the Baz tab). After jumping back to tab where required field is you get noticed that that field is required. I think that kind of behavior is not wanted before clicking Big Red Button.