Hey Candide,

i'd the same problem, but i find a solution.

edit action.class.php (apps/frontend/modules/comment/actions/
actions.class.php) and search for the processForm function.
modify this function like this code:

protected function processForm(sfWebRequest $request, sfForm $form)
  {
        $this->form->setDefault('blog_post_id', $request->getParameter
('post_id'));
    $form->bind($request->getParameter($form->getName()), $request-
>getFiles($form->getName()));
    if ($form->isValid())
    {
      $blog_comment = $form->save();

          //$this->redirect('comment/edit?id='.$blog_comment->getId());
          $this->redirect('post/show?id='.$blog_comment->getBlogPostId());
    }
  }


it might be work


have a nice weekend

mick

On 17 Feb., 22:23, ckemmler <[email protected]> wrote:
> Thank you alex! But unfortunately I'm afraid I don't understand what
> you mean. Besides I suppose you're really giving me an alternative
> solution, whereas I actually want to understand what is going on. I
> suspect I have made some mistake, but it's also possible that there's
> an error in the tutorial, in which case it might be interesting for
> everyone to know about it.
>
> Thanks again & take care,
>
> Candide
>
> On Feb 17, 10:07 pm, Alexandru-Emil Lupu <[email protected]> wrote:
>
> > hi!
> > i will tell you just one thing.
>
> > php symfony propel:generate-module        Generates a Propel module
> > (propel-generate-crud, propel:generate-crud)
>
> > usually "propel:generate-crud" creates a generator file and an action. click
> > on the link and after that browse
> > "SF_ROOT/cache/frontend/dev/modules/autoComments/actions/actions.class.php"
> > there you should search for "getCommentsOrCreate()"
> > Alecs
>
> > On Tue, Feb 17, 2009 at 8:19 PM, ckemmler <[email protected]> wrote:
>
> > > Hello, I'm obviously a symfony beginner (php is new to me too as I'm
> > > coming from a java background); I'm following the tutorial at
> > >http://www.symfony-project.org/tutorial/1_2/my-first-project
>
> > > I'm in the section titled "Addarecordrelativetoanothertable"
>
> > > I got two problems actually; the first one I could circumvent, but not
> > > the second. And I'm surprised about the first one too, so here it is.
>
> > > The section is about letting a useradda comment from the blog_post
> > > form instead of having users create a new comment and choose a post
> > > from there. So,
>
> > > <?php echo link_to('Adda comment', 'comment/edit?post_id='.$blog_post-
> > > >getId()) ?>
>
> > > Clicking that link generates an error; however, that line is meant to
> > > allow the creation of a *new* comment, right? Well why then the "edit"
> > > action? If I change that to
>
> > > <?php echo link_to('Adda comment', 'comment/new?post_id='.$blog_post-
> > > >getId()) ?>
>
> > > Then I get the correct form.
>
> > > That was my first problem. But did I actually corrected in the
> > > tutorial? I find it hard to believe.
>
> > > The second problem is just after that, when configuring the
> > > blog_comment form. We are passed a blog_post's id as a parameter, and
> > > the idea is to pass that in the form as a hidden field. Hence, the
> > > tutorial states that we shouldaddthe following in the form's
> > > configure method:
>
> > > $this->widgetSchema['blog_post_id'] = new sfWidgetFormInputHidden();
>
> > > However, in the resulting form, the hidden field has no value, which
> > > results, again, in an error.
> > > Now, if I artificiallyadda value in that field, it works:
>
> > > $this->widgetSchema['blog_post_id'] = new sfWidgetFormInputHidden(array
> > > (),array("value"=>"3"));
>
> > > So it just seems that there's some implicit thing that I must have
> > > missed.
>
> > > Any help will be very much appreciated,
>
> > > Candide

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