Problem SOLVED!  Thanks to Hector and Riesen.

    public function editAction()
    {
        $this->view->title = "Edit album";
        $this->view->headTitle($this->view->title, 'PREPEND');

        $form = new Form_Album();
        $form->submit->setLabel('Save');
        $this->view->form = $form;

//......................................
*// Riesen test*

        if ($this->getRequest()->isPost() &&
$form->isValid($this->getRequest()->getPost())) {
            $values = $form->getValues();
            Zend_Debug::dump($values);
*            exit;  // Hector =)*
        }
//......................................

        if ($this->getRequest()->isPost()) {
            $formData = $this->getRequest()->getPost();

//......................................
// Testing123

//        Zend_Debug::dump($formData);
//        exit;
//        print_r($formData);
//......................................

            if ($form->isValid($formData)) {
                $id = (int)$form->getValue('id');
                $artist = $form->getValue('artist');
                $title = $form->getValue('title');
                $category = $form->getValue('category');
                $albums = new Model_DbTable_Albums2();
                $albums->updateAlbum($id, $artist, $title, $category);

                $this->_redirect('/');
            } else {
                $form->populate($formData);
            }
        } else {
            $id = $this->_request->getParam('id', 0);
            if ($id > 0) {
                $albums = new Model_DbTable_Albums2();
                $form->populate($albums->getAlbum($id));
            }
        }
    }


/allergic




On Tue, Jul 6, 2010 at 5:35 PM, W Itch <
[email protected]> wrote:

> How can I print_r or Zend_Debug *$formData* in my editAction?
> I want to see what values this array contains.
>
> The MVC code separation makes me confused with how to check and see the
> contents in certain variables and arrays.
> That's not created by me manually from the View part.
>
>
>
>         public function editAction()
>         {
>                 $this->view->title = "Edit album";
>                 $this->view->headTitle($this->view->title, 'PREPEND');
>
>                 $form = new Form_Album();
>                 $form->submit->setLabel('Save');
>                 $this->view->form = $form;
>
>                 if ($this->getRequest()->isPost()) {
>                         *$formData* = $this->getRequest()->getPost();
>
> //...........................................................
> *// LOOK AT ME, OVER HERE!  Testing123*
>
> //        Zend_Debug::dump($formData);
>         print_r($formData);
> //...........................................................
>
>
>                         if ($form->isValid($formData)) {
>                                 $id = (int)$form->getValue('id');
>                                 $artist = $form->getValue('artist');
>                                 $title = $form->getValue('title');
>                                 $category = $form->getValue('category');
>                                 $albums = new Model_DbTable_Albums2();
>                                 $albums->updateAlbum($id, $artist, $title,
> $category);
>
>                                 $this->_redirect('/');
>                         } else {
>                                 $form->populate($formData);
>                         }
>                 } else {
>                         $id = $this->_request->getParam('id', 0);
>                         if ($id > 0) {
>                                 $albums = new Model_DbTable_Albums2();
>                                 $form->populate($albums->getAlbum($id));
>                         }
>                 }
>         }
>

Reply via email to