2008年8月5日星期二

Re: [fw-mvc] Zend_Form_Element will be created twice 7A2-99B

Yet again?

The block messages come from a badly configured mail server that is somehow subscribed to the ZF lists. Mail Wil about this (forward the full block message); he will remove the mail adresses that cause them. Maybe a kick in the butt for that mail server admin is also appropriate, since they seem to subscribe to the lists again and again, only to mess this up.

Regards
Tobias

2008/8/5 Paul Shoemaker <paul.shoemaker@helloecho.com>
Sorry if this is a resend I received a block message last time ...

Paul Shoemaker | Application Developer
paul.shoemaker@helloecho.com
615.290.4342 | 615.777.5119 fax
 
echo  |  Hello. Hello.  |  helloecho.com
 
The information contained in this message is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.




From: Paul Shoemaker <paul.shoemaker@helloecho.com>
Date: Tue, 5 Aug 2008 14:34:58 -0500
To: Axel Wüstemann <awu@qbus.de>, <fw-mvc@lists.zend.com>
Subject: Re: [fw-mvc] Zend_Form_Element will be created twice

The only thing I can think of is that this part resolves to true when PARENT_ID is passed as a parameter:


        if($this->getDisplayGroup('hiddenFields')) {
            $this->getDisplayGroup('hiddenFields')->addElement($oHidden);    

Without seeing more of your implementation I can't verify that.
Paul Shoemaker | Application Developer
paul.shoemaker@helloecho.com
615.290.4342 | 615.777.5119 fax
 
echo  |  Hello. Hello.  |  helloecho.com
 
The information contained in this message is intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.




From: Axel Wüstemann <awu@qbus.de>
Date: Tue, 5 Aug 2008 14:29:53 -0500
To: <fw-mvc@lists.zend.com>
Subject: [fw-mvc] Zend_Form_Element will be created twice



Hi,

why the second hidden element will be created twice?

class EventForm extends My_Form {
       
    public function init() {
       
        $this->addHiddenElement('ID');
        $this->addHiddenElement('PARENT_ID');
    }  
}

class My_Form extends Zend_Form {

   protected $_aHiddenDecorators     = array(
        array('ViewHelper')
    );

   protected $_aHiddenGroupDecorators = array(
        'FormElements'
    );

    public function loadDefaultDecorators() {
        $this->setDecorators(array(
            'FormElements',
            'Form',
        ));
    }

    /**
     * builds a hidden element and adds it to the 'hiddenFields' display
group
     * if the display group does not yet exists, it will be created
     */
    public function addHiddenElement($fp_sName, $fp_aOptions = null) {
       
        $oHidden = $this->createElement('hidden', $fp_sName, $fp_aOptions);
        $oHidden->setDecorators($this->_aHiddenDecorators);
        $this->addElement($oHidden);

        if($this->getDisplayGroup('hiddenFields')) {
            $this->getDisplayGroup('hiddenFields')->addElement($oHidden);    
        } else {
            $this->addDisplayGroup(array($oHidden->getName()),
'hiddenFields', array(
                'decorators' => $this->_aHiddenGroupDecorators,
                ));
        }
    }

<form enctype="application/x-www-form-urlencoded" action=".." method="post">

<input type="hidden" name="ID" value="" id="ID">
<input type="hidden" name="PARENT_ID" value="" id="PARENT_ID">
<input type="hidden" name="PARENT_ID" value="" id="PARENT_ID">

</form>

thank you for any help,

Axel
--
View this message in context: http://www.nabble.com/Zend_Form_Element-will-be-created-twice-tp18838277p18838277.html
Sent from the Zend MVC mailing list archive at Nabble.com.




没有评论: