Witam. Walcze z formularzem, mianowicie mam widget propelchoice pobierajacy liste wiadomosci. Zaznaczam pozycje ktore chce usunac, to wychodzi na to, ze pobiera pusta tablice. Jak moge zaznaczone pozycje usunac ?

  1. <?php
  2. public function executeIndex(sfWebRequest $request)
  3. {
  4. $this->form = new MailboxForm();
  5. }
  6. public function executeRemoveSelected(sfWebRequest $request)
  7.  {
  8.      
  9.      $this->form = new MailboxForm();
  10.      
  11.      $this->processForm($request, $this->form);
  12.      
  13.      $this->setTemplate('Index');
  14.      
  15.  }
  16. ?>


  1. <?php
  2. protected function processForm(sfWebRequest $request, sfForm $form)
  3.  {
  4.    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
  5.    if ($form->isValid())
  6.    {
  7.        if($form->getName() == 'emailfriend')
  8.        {
  9.            $tp_mail_inbox = new TpMailInbox();
  10.            $tp_mail_inbox->setIdUser($this->getUser()->getFlash('friend'));
  11.            $tp_mail_inbox->setFromWho($this->getUser()->getGuardUser()->getId());
  12.            $tp_mail_inbox->setMessage($form->getValue('message'));
  13.            $tp_mail_inbox->setSubject($form->getValue('subject'));
  14.            $tp_mail_inbox->save();
  15.        }
  16.        
  17.        elseif($form->getName() == 'newmessage')
  18.        {
  19.            $tp_mail_inbox = $form->save();
  20.        }
  21.        
  22.        elseif($form->getName() == 'mailbox')
  23.        {
  24.            foreach ($form->getValue('id_user') as $mes)
  25.            {
  26.                $message = TpMailInboxPeer::retrieveByPk($mes);
  27.                $message->setDeleted(True);
  28.                $message->save();
  29.            }
  30.        }
  31.        
  32.      
  33.  
  34.      $this->redirect('mail');
  35.    }
  36.  }
  37. ?>


indexsuccess.php

  1. <?php
  2. [b]Mailbox List[/b]
  3.  
  4.  
  5.  
  6.  
  7.    
  8.      
  9.    
  10.  
  11.  
  12.    
  13.      
  14.      
  15.    
  16.    
  17.      
  18.      
  19.  
  20. renderError() ?>



Problem rozwiązany, wątek nieaktualny. Trzeba było wysłać postem formularz i dodac przycisk name=submit, wowczas formularz jest bounce i zwalidowany.