My form code:
<? echo form_remote_tag(array(
'update' => array('success' => 'listEntities', 'failure' =>
'create_form'),
'url' => 'mbmkt_entity/update',
)) ?>
<table class="tableForm" cellpadding="0" cellspacing="0">
<? echo $form; ?>
<? echo $form->renderGlobalErrors() ?>
<? include_partial('global/formFooter');?>
</table>
</form>
My create action:
public function executeCreate()
{
$this->form = new MbmktEntityForm();
$this->setTemplate('edit');
}
My edit action:
public function executeEdit(sfWebRequest $request)
{
$this->form = new MbmktEntityForm(MbmktEntityPeer::retrieveByPk
($request->getParameter('id')));
}
My update action:
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod('post'));
$this->form = new MbmktEntityForm(MbmktEntityPeer::retrieveByPk
($request->getParameter('id')));
$this->form->bind($request->getParameter('entity'), $request-
>getFiles('entity'));
if ($this->form->isValid())
{
$entity = $this->form->getObject();
$entity->save();
}
$this->setTemplate('edit');
}
I hope this helps. Thanks a lot for your help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---