Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #2913 Crosslink (Checkbox) Problem
Submitted: 2004-12-07 08:29 UTC Modified: 2006-12-16 02:28 UTC
From: alex dot petri at gmx dot de Assigned: justinpatrin
Status: Closed Package: DB_DataObject_FormBuilder
PHP Version: 4.3.9 OS: W2K
Roadmaps: (Not assigned)    
Subscription  


 [2004-12-07 08: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

Comments

 [2004-12-07 11:38 UTC] justinpatrin
I've submitted a tentative fix to CVS which puts $key in the name of the element. I haven't put in the setDefaults stuff as it doesn't do anything useful for checkboxes (i.e. it doesn't check them). From my quick testing it looks like unchecked checkboxes are still checked upon submission (newly checked checkboxes work fine).
 [2004-12-07 14:34 UTC] justinpatrin
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. Thanks much, I don't know why I thought that setDefaults didn't work on checkboxes... I've also fixed the tripleLinks. Please try the code in CVS and let me know if it works for you.