History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-4445
Type: Docs:  Problem Docs: Problem
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Matthew Weier O'Phinney
Reporter: Felix De Vliegher
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Chapter "19.9.2. Multi-Page Forms" has code examples with some wrong code

Created: 02/Oct/08 02:23 AM   Updated: 02/Oct/08 06:00 AM
Component/s: Zend_Form
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Language: English
Tags:
Participants: Felix De Vliegher and Matthew Weier O'Phinney


 Description  « Hide
The Code example below has the wrong class definition:
Multi-page forms code example
class My_Form_Registration extends Zend_Form
{
    // ...
    
    /**
     * Is the sub form valid?
     * 
     * @param  Zend_Form_SubForm $subForm 
     * @param  array $data 
     * @return bool
     */
    public function subFormIsValid(Zend_Form_SubForm $subForm,
                                   array $data)
    {
        $name = $subForm->getName();
        if ($subForm->isValid($data)) {
            $this->getSessionNamespace()->$name = $subForm->getValues();
            return true;
        }

        return false;
    }

    /**
     * Is the full form valid?
     * 
     * @return bool
     */
    public function formIsValid()
    {
        $data = array();
        foreach ($this->getSessionNamespace() as $key => $info) {
            $data[$key] = $info;
        }

        return $this->getForm()->isValid($data);
    }
}

Instead, it should show:

Multi-page forms code example - correct
class RegistrationController extends Zend_Controller_Action
{
    // class contents...


 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Matthew Weier O'Phinney - 02/Oct/08 06:00 AM
Corrected in trunk; thanks for the report.