Cytat(thomas2411 @ 29.06.2009, 13:32:54 )

Ten kod wydaje mi się dobry, używam taki sam i u mnie działa. A pokaż wcześniejszą część, jak pobierasz info o formualrzu...Wklej całe processForm
metoda processForm
<?php
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid())
{
$party = TpPartyPeer::getParty($token = $request->getToken());
foreach($form->getValue('id_user') as $id_user)
{
$user = new TpInvitedParty();
$user->setIdUser($id_user);
$user->setFromWho($this->getUser()->getGuardUser()->getId());
$user->setParty($party->getId());
$user->save();
}
$this->redirect('invite');
}
}
?>
i formularz:
<?php
class InvitePartyForm extends BaseTpInvitedPartyForm
{
public function configure()
{
unset($this['accept'], $this['deleted'], $this['party'], $this['from_who']);
if(sfContext::hasInstance())
{
$this->widgetSchema['id_user'] = new sfWidgetFormPropelChoiceMany
((array('model' => 'FriendsView', 'add_empty' => false, 'criteria' => FriendsViewPeer
::getFriendsView($id = intval(sfContext
::getInstance()->getUser()->getGuardUser()->getId())), 'key_method' => 'getIdFriend', 'multiple' => true )));
$this->validatorSchema['id_user'] = new sfValidatorPropelChoiceMany
(array('model' => 'FriendsView', 'criteria' => FriendsViewPeer
::getFriendsView($id = intval(sfContext
::getInstance()->getUser()->getGuardUser()->getId())), 'multiple' => true));
}
}
}
?>
Zrobilem mala probe i doszedlem do tego, ze przy zastosowaniu: $form->getValue('id_user') nie zwraca nic. Natomiast gdy zastosuje $form->getWidget('id_user')->getChoices() zwraca mi " Array ". Nie wiem co jest grane..;/
Warto bylo posiedziec. Odpowiedz jest banalna!
otoz jak sie okazuje zmieniajac widget z propelchoicemany na PROPELCHOICE z opcja multiple=>true wszystko działa i zapisuje tyle rekordow, ile jest zaznaczonych pozycji w liscie...