Re: QF/QFC - odd behaviour?

From: Date: Tue, 14 Oct 2003 14:46:03 +0000
Subject: Re: QF/QFC - odd behaviour?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8432@lists.php.net to get a copy of this message
Hi! Markus wrote:
I've had some problem with dynamically changing the contents of a QFC page. Below is a complete example to show the problem. I hope you understand what I mean if you look at it and test it. Just cut and paste. Is it a bug or what am I doing wrong?
First of all, this is not Controller-related, this behaviour will appear with just QF as well. You basically need to do setValue() on elements *after* setting the constant/default values. While this can be considered a bug, it is not easy to fix so it will likely stay this way.
class SimplePage extends HTML_QuickForm_Page {
    function buildForm()
    {
        $this->_formBuilt = true;
        $this->addElement('text', 'dummy', 'A dummy value:');
        $text =& $this->addElement('textarea', 'tstText', 'Please enter
something:');
        $text->setRows(8);
        $text->setCols(40);
        $text->setValue("Last edit at:
".date('H:i:s')."\n".$text->getValue());
        $this->addElement('submit', $this->getButtonName('add_edit_time'),
'Add edit time');
        // *** Uncomment any of these will cause the form to misbehave! ***
        // $this->setConstants(array('dummy' => 'A constant Value'));
        // $this->setDefaults(array('dummy' => 'A default Value'));
    }
}


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