Hi, If you use the normal form ({$model}Form) and no forwardUnless etc, does it works ? In such a case, this kind of action is pretty simple:
In fact you want something to toggle the active state. From 1->0 and from 0->1... public function executeToggleActivate($request) { $this->getRoute()->getObject()->set('activate', ! $this->getRoute()->getObject()->get('activate')); $this->getRoute()->getObject()->save(); } Perhaps the sense of the action doesnt fit with your requirements. You still can set the activate value using a (boolean) $request->getParameter('activate'); instead of the ->....->get('activate) Cheers, Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Wed, Apr 7, 2010 at 4:23 PM, Jorge Krug <mercu...@gmail.com> wrote: > I have here a crud with two options: active and inactive. > > The idea is when the user click on the icon, change the value of field to 0 > or 1, true or false. > > I have tried everything but i couln´t actualize the field. > > The commented lines show my frustrated tries. > > > > The View: > > <?php echo link_to('Atualizar', > 'EventsEvents/activate?id='.$events_events->getId().'&active=1', > array('method' => 'post', 'class' => 'bt-desactive')) ?> > > action.class.php > > public function executeActivate(sfWebRequest $request) > { > $this->forward404Unless($request->isMethod(sfRequest::POST) || > $request->isMethod(sfRequest::PUT)); > $this->forward404Unless($events_events = > Doctrine::getTable('EventsEvents')->find(array($request->getParameter('id'))), > sprintf('Object events_events does not exist (%s).', > $request->getParameter('id'))); > $this->form = new EventsEventsActivateForm($events_events); > //$this->form = new EventsEventsActivateForm(array('id' => > $request->getParameter('id'), 'active' => > $request->getParameter('active'))); > > //$this->form->bind($request->getParameter($this->form->getName())); > //$form->bind($request->getParameter('active'), > $request->getParameter('id')); > //$form->bind(array('id' => $request->getParameter('id'))); > //$form->setOption('active', $request->getParameter('active')); > //$form->setOption('id', $request->getParameter('id')); > > //$form->setDefault('id', $request->getParameter('id')); > //$form->setDefault('active', $request->getParameter('active')); > > //$form->updateObject(); > //var_dump($request->getParameter('id')); > > $this->form->bind($request->getParameter($this->form->getName()), > $request->getFiles($this->form->getName())); > if ($this->form->isValid()) > { > //$this->form->getObject()->setId($request->getParameter('id')); > > //$this->form->getObject()->setActive($request->getParameter('active')); > var_dump($this->form); > $events_events = $this->form->save(); > //$this->redirect('EventsEvents/index'); > } > > //$events_events = $this->form->save(); > //$this->processForm($request, $this->form); > //$this->redirect('EventsEvents/index'); > } > > sql genereted > > UPDATE events_events SET id = '', active = '' WHERE id = '1' > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en To unsubscribe, reply using "remove me" as the subject.