Problem with posting and validating comments in an article |
[eluser]opel[/eluser]
I have almost finished coding my own blog system but I have one problem on validating the form and error messages when I post a comment related to an article. My form appears in the view related to the article method and view e.g. site.com/blog/article/uniqueid When I post the comment from the form I point the form to site.com/blog/comment. This what I have in my comment method : Code: function comment($id = NULL) When a commment is succesfull it posts the person back to the article and submits the data to the db. The code above does this successfully. The issue I am having is the the form validation and the error message is not displaying. I guess this is to do with one controller displaying and another validating. I want the errors to appear on my article method/view. Any help appreciated, thanks.
[eluser]TheFuzzy0ne[/eluser]
Use [url="http://ellislab.com/codeigniter/user-guide/libraries/sessions.html"]flashdata[/url].
[eluser]Thorpe Obazee[/eluser]
It should go this way: 1. if validation is successful it saves the post to the table. 2. you set flashdata 3. you redirect. Quote:When a commment is succesfull it posts the person back to the article and submits the data to the db. The code above does this successfully.
[eluser]opel[/eluser]
Sorry I don't think I explained the problem correctly. I can insert the comment and redirect. The issue is that I have the form displaying inside the article method of my blog class but my form is POSTing to the comment method. The validation from the comment method doesn't work. Should my above code be moved into the article method or can I keep the comment code separate ?
[eluser]Thorpe Obazee[/eluser]
I believe you have a very similar problem with this. http://ellislab.com/forums/viewthread/114933/ |
Welcome Guest, Not a member yet? Register Sign In |