I've managed something similar but still having a problem:

I've modifyed the the form to add to it a widget to let user select the post
related to this comment
$this->setWidget('post', new sfWidgetFormDoctrineChoice(...)
$this->setValidator....

then create a new action addComment to the post actions, in this one you'll
have to check for request params
something similar to this:
    /**
     * Action to create a subnode
     * @param sfWebRequest $request
     * @return void
     */
    public function executeCreateSubPage( sfWebRequest $request )
    {
        $request->setParameter('parent',
$this->getRoute()->getObject()->getId() );
        $this->forward('vs_basicpage', 'create');
    }

then in the create action :
    /**
     * (non-PHPdoc)
     * @see
cache/backend/dev/modules/autoVs_basicpage/actions/autoVs_basicpageActions#executeCreate($request)
     */
    public function executeCreate( sfWebRequest $request )
    {
        parent::executeCreate( $request );
        if( $request->hasParameter( 'parent' ) )
        {
            $iDesiredParentId = $request->getParameter( 'parent' );
            if( $parent = Doctrine_Core::getTable( 'vsBasicpage'
)->findOneById( $iDesiredParentId ) )
            {
                $this->form->setDefault( 'parent', $iDesiredParentId );
            }
        }
    }

This is nearly what you want to do afai understand

I still get errors : csrf token error (value is not set), it looks like the
framework thinks I wanted it to validate & save the object form instead of
simply echoing the form for new action

Before Printing, Think about Your Environmental Responsibility!
Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!


On Thu, Jan 14, 2010 at 2:26 PM, blissdrop <[email protected]> wrote:

> Thank you for reply.
>
> Here is the explanation:
>
> The task is rather trivial, I have posts and I want to add comments to
> posts. I've learned, how to add comment form to the single post page,
> but I cannot find out how to pass post_id to the comment create action
> and how to asociate comment with particular post.
>
> There must be a simple solution, but I was unable to find it via
> google.
>
> --
> 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]<symfony-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>
>
>
--
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.

Reply via email to