RE: [PEAR] FormBuilder subforms

From: Date: Thu, 19 Jan 2006 16:31:55 +0000
Subject: RE: [PEAR] FormBuilder subforms
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22610@lists.php.net to get a copy of this message
That's not how they appear on my forms. The processing works, ie the div is displayed and new records are created but the fields are grouped one after another with only the select field's label displayed. Refer DB\DataObject\FormBuilder\QuickForm.php function &_createSelectBox <code> if (isset($links[$fieldName])) { list($table,) = explode(':', $links[$fieldName]); require_once('DB/DataObject/FormBuilder/QuickForm/SubFormFB.php'); $element->addOption($this->linkNewValueText, $this->linkNewValueText); $element->updateAttributes(array('onchange' => 'db_do_fb_'.$this->_fb->getFieldName($fieldName).'__subForm_display(this)')) ; $element->updateAttributes(array('id' => $element->getName())); $this->_prepareForLinkNewValue($fieldName, $table); $subFormElement =& HTML_QuickForm::createElement($this->_getQFType('subForm'), $this->_fb->getFieldName($fieldName).'__subForm', '', $this->_linkNewValueForms[$fieldName]); $subFormElement->setPreValidationCallback(array(&$subFormElement, 'preValidationCallback')); $subFormElement->linkNewValueText = $this->linkNewValueText; $subFormElement->selectName = $this->_fb->getFieldName($fieldName); $el =& $this->_form->addElement('hidden', $this->_fb->getFieldName($fieldName).'__subForm__displayed'); $el->updateAttributes(array('id' => $el->getName())); $element =& HTML_QuickForm::createElement('group', $this->_fb->getFieldName($fieldName), $this->_fb->getFieldLabel($fieldName), array($element, $subFormElement), '<br/>', false); } } } return $element; </code> The HTML returned is an unformatted group element. The originating form is rendered by Array_Smarty however the SubForm should be rendered directly toHTML in the div and appear as a standard FB form. It doesn't. Do you have any suggestions for troubleshooting this problem? Prue -----Original Message----- From: Justin Patrin [mailto:papercrane@gmail.com] Sent: Friday, 20 January 2006 2:51 AM To: prue@clipmagic.com.au Cc: pear-general@lists.php.net Subject: Re: [PEAR] FormBuilder subforms On 1/19/06, Prue <prue@clipmagic.com.au> wrote: > Hello > > Is there a way to limit the number of fields that are grouped in a > subform? The newLinkValue table has many fields but only a couple are > needed. It's difficult to determine which is which when they're all > lined up together with only the select field label displayed. Better > still, is is possible to format the fields in the subform group with > their own labels? If so, please let me know. > I have no idea what you're talking about. SubForms, such as those for linkNewValue, normally have the same formatting as a normal form, with all of their own labels. For an example, see the following link and choose "--New Value--" for Genre. http://pear.reversefold.com/EditRecord.html SubForms are not groups; they're SubForms. They only have groups within them if that's the way you set up that DO's form. If you want to limit the fields in a FormBuilder form you do it the same way whether or not it's a form or a SubForm, you set the options in the DO class (such as fieldsToRender). If want it different when it's a SubForm use the prepareLinkedDataObject callback on the main form's DO. -- Justin Patrin

« previous php.pear.general (#22610) next »