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

Request #5992 Support for defining field label as array
Submitted: 2005-11-17 07:12 UTC
From: alex at cgi-central dot net Assigned:
Status: Open Package: DB_DataObject_FormBuilder
PHP Version: 4.3.11 OS: any
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-17 07:12 UTC] alex at cgi-central dot net
Description: ------------ HTML_QuickForm supports defining field labels as array. Have a look to pear/docs/HTML_QuickForm/docs/renderers/multiple-labels.php Howevr, when you define field label as array in $fb_FieldLabels array, it is handled incorrectly ("Array" is passed instead of field title to addRule function). Below patch will fix this situation. I hope this is self-explanatory Test script: --------------- diff -ur DataObject-orig/FormBuilder/QuickForm.php DataObject/FormBuilder/QuickForm.php --- DataObject-orig/FormBuilder/QuickForm.php Thu Oct 20 13:01:36 2005 +++ DataObject/FormBuilder/QuickForm.php Mon Oct 24 10:21:33 2005 @@ -787,13 +787,13 @@ } if ($rule['rule'] === false) { $this->_form->$ruleFunction($realFieldName, - sprintf($rule['message'], $fieldLabel), + sprintf($rule['message'], is_array($fieldLabel)? $fieldLabel[0] : $fieldLabel), $rule['validator'], '', $ruleSide); } else { $this->_form->$ruleFunction($realFieldName, - sprintf($rule['message'], $fieldLabel), + sprintf($rule['message'], is_array($fieldLabel)? $fieldLabel[0] : $fieldLabel), $rule['validator'], $rule['rule'], $ruleSide);

Comments