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
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.

Reply via email to