On Fri, Feb 20, 2009 at 4:43 PM, David Zülke
<[email protected]> wrote:
> Anyway, one major issue with your approach is that you seem to be POSTing to
> the "post" action, relying on the fact that it loads a slot for the comments
> which then creates the comment in that special case. That's really, really
> wrong from a logical point of view, and it also violates the principles of
> HTTP, not to mention proper separation of concerns.
I do now, finally, see that this is a bad idea. Although perhaps I'm
not clear about the principles of HTTP argument...

> What you should do is post to an "AddComment" action or so, and, on success,
> *redirect* back to the post page. On error, you would *forward* back to the
> post page (which contains a slot for the comments form again).
I think I am finally getting you...So I should have a route that
routes only to the AddComment action. However, I'm thinking that the
URL for the AddComment action should actually be the same as the
ShowPost action. This is because, in case of errors, I would expect to
stay at the same page, and not move anywhere else.

So, I could have a hidden value in the form, say "isCommentSubmision".
Would it be possible (and also would it be an ok solution) to route
based on this value as a POST variable? How would this be done? But is
this a bad idea?

> However, that won't solve your problem - the validation report is in the
> AddComment action's execution container, so FPF will not see the validation
> errors.
>
> That's quite unfortunate, and I'm mildly surprised that nobody has come up
> with this issue so far. Anyway, in 1.0-HEAD, you have the ability to specify
> an explicit validation report object for FPF to use instead of the current
> container's (http://trac.agavi.org/ticket/1050). That should solve your
> problem. So in your AddCommentErrorView, you'd do something like:
>  $this->getContext()->getRequest()->setAttribute('validation_report',
> $this->getContainer()->getValidationManager()->getReport(),
> 'org.agavi.filter.FormPopulationFilter');
>  return $this->createForwardContainer('Module', 'ViewPost');
Thanks: I will try this,

Thanks again,

Michal.

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to