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 "Add a record relative to another table"

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 user add a 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('Add a 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('Add a 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 should add the 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 artificially add a 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to