PEAR is archived and read-only

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

Home » Database » DB_DataObject_FormBuilder » Bug #2913

Crosslink (Checkbox) Problem

Details

Submitted2004-12-07 13:29 UTC
Fromalex dot petri at gmx dot de
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP Version4.3.9
OSW2K
Roadmaps(Not assigned)

Comments

[2004-12-07 13:29 UTC] alex dot petri at gmx dot de

Description:
------------
if you have crossinks in your Form that is generated with DO Formbuilder, and you click on submit, the values are stored in DB correctly but they dont display correctly.
This error occurs, if you process a form, and freeze it after it is submitted. And if you have fields(i.e. textfields) with rules - which causes errors on submit (through wrong userdata)- then the data from checkboxes are also lost.

Reproduce code:
---------------
in file DB/DataObject/FormBuilder.php
goto method &_generateForm(...)
Line around 962 fill in:

if(in_array($key, $selected_options)){
// echo "direct from DB ---- > ";
$crossLinkDefaults[$groupName][$key]=$key;
// echo $key."<br>\n";
}
// old one:
// $crossLinksElement = $this->_createCheckbox($groupName.'['.$key.']', $value, $key, in_array($key, $selected_options));
$crossLinksElement = $this->_createCheckbox($groupName.'['.$key.']', $value, $key, false);

and on LINE 1185 (these are the last lines of this method)

// Assign default values to the form
//print_r($crossLinkDefaults);
if(isset($crossLinkDefaults)) $formValues=array_merge($formValues,$crossLinkDefaults);
$form->setDefaults($formValues);
return $form;

Expected result:
----------------
now crosslinks work correctly, as expected
the same could be done with tripleLinks