You can do it in 2 ways : - render the same view, meaning you have to collect data again and keep $this->data - submit via ajax, as cakeFreak mentioned, and handle error display or redirect in an updated div (using javascript mainly, to insert a div- error or a new window.location for redirect). I have done this many times without problem.
On Oct 25, 1:34 am, LW <[EMAIL PROTECTED]> wrote: > Dixon, > did you find a solution to this problem? > I've been struggling with a similar situation and haven't found a way > through it yet. > > Lutz > > On 6 Okt., 13:47, cakeFreak <[EMAIL PROTECTED]> wrote: > > > Did you try to load the comments form via Ajax? > > > Dan > > > On 5 Ott, 02:19, dixon_ <[EMAIL PROTECTED]> wrote: > > > > Hi all bakers! > > > > I'm developing just another CMS application to learn the Cake > > > framework. Really impressed so far! > > > > I'm implementing a commenting system to my posts on the blog. I've > > > associated Comment and Post models correctly and placed the submission > > > form in an element that is rendered from the post view, as it should > > > (any other suggestions?). Then I've set the form URL action to "/ > > > comment/add" where I add data to the Comment model and then > > > redirecting the user back to the post view. Everything works so long, > > > records are showing up and associations are being made etc... > > > > The problem is when a field is invalid while trying to save data in > > > the CommentsController. How should I handle this? I cannotredirect > > > the user back to the post view to show errors, as we are loosing all > > > data in the redirection. I could let it auto render the default view > > > for the "/comment/add" action (which just would be a submission form) > > > without any Post data, but that just doesn't make sense. > > > > To make my problem short: Can anyone show me examples on how to add a > > > comment from a post view, and still be able to showvalidationerror > > > messages etc (as in normal cases)? > > > > Cheers from Sweden. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
