We have recently upgraded to Umbraco 7. We are trying to develop a comment system where a user can write comments to a single blog post. The user completes a form and submits their comment.
Now we have the doc types set up for the comments. These comments are child nodes of the blog post doc. What we want is to be able to create new comment nodes whenever the user hits the submit button.
The issue:-
I have created a custom controller (inherits SurfaceController) and model (inherits RenderModel). I have passed the model into the blog view and by using the html helper I am able to display a form which contains inputs for each model property. Now when I fill out the form and hit the submit button nothing happens. A new node is NOT created and nothings gets added to the db.
I have followed the Umbraco SurfaceContoller tutorial etc.
Here is my custom controller:-
public class uBlogsyPostSurfaceController : SurfaceController
{
public ActionResult uBlogsyPost()
{
return PartialView("~/Views/Partials/uBlogsy/Post/CommentsList.cshtml", new PostCommentsViewModel());
}
[HttpPost]
[ActionName("uBlogsyPost")]
public ActionResult uBlogsyPostNewComments(PostCommentsViewModel model)
{
return RedirectToCurrentUmbracoPage();
}
}
I'm afraid not - It seems that the old documentation for legacy Umbraco 4 installations have vanished over the years - I did a quick google search and can't seem to find any information about the old API's.
Perhaps one can find something using the waybackmachine.org or by being very patient browsing through the results fond on Google.
There are probably code samples etc. floating around on several blogs etc, which might enough to get you going - All of the above stuff is possible using the old API but without documentation it can of course be a bit hard to figure out when to do what etc.
One blog that might be a good place to see if you can digg up something useful is http://www.nibble.be/?paged=18 - I set it to start at the very first page from 2008 - Try skimming through the post headlines and see if at some point there is something of interest - Tim has been doing a lot of nice stuff with the Umbraco API over the years - Hit the previous link in the bottom to see the newer posts. If you start by just going to the frontpage it will all be about Umbraco 7 and the new API's.
Create new content nodes programmatically
Hi guys,
We have recently upgraded to Umbraco 7. We are trying to develop a comment system where a user can write comments to a single blog post. The user completes a form and submits their comment.
Now we have the doc types set up for the comments. These comments are child nodes of the blog post doc. What we want is to be able to create new comment nodes whenever the user hits the submit button.
The issue:-
I have created a custom controller (inherits SurfaceController) and model (inherits RenderModel). I have passed the model into the blog view and by using the html helper I am able to display a form which contains inputs for each model property. Now when I fill out the form and hit the submit button nothing happens. A new node is NOT created and nothings gets added to the db.
I have followed the Umbraco SurfaceContoller tutorial etc.
Here is my custom controller:-
}
Here is my View:-
Cheers.
Hi Edd and welcome to our :)
If you need to create a node based on some input from your front-facing website you should have a look at the API documentation here http://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService
/Jan
Jan,
Thank you for this and thanks for the quick response.
Edd
Thank you this document was create. I was able to create new nodes from our website.
Here is how I achieved this in case anyone else ran into the same issue:-
Custom Controller:-
View:-
@using (Html.BeginUmbracoForm("uBlogsyPost", "uBlogsyPostSurface")) {
Hi Edd
Thanks for sharing! :) #h5yr
/Jan
Sorry,but can you please tell me how to make umbraco 4 allow all these functions?
Hi Calesire
I'm afraid not - It seems that the old documentation for legacy Umbraco 4 installations have vanished over the years - I did a quick google search and can't seem to find any information about the old API's.
Perhaps one can find something using the waybackmachine.org or by being very patient browsing through the results fond on Google.
There are probably code samples etc. floating around on several blogs etc, which might enough to get you going - All of the above stuff is possible using the old API but without documentation it can of course be a bit hard to figure out when to do what etc.
One blog that might be a good place to see if you can digg up something useful is http://www.nibble.be/?paged=18 - I set it to start at the very first page from 2008 - Try skimming through the post headlines and see if at some point there is something of interest - Tim has been doing a lot of nice stuff with the Umbraco API over the years - Hit the previous link in the bottom to see the newer posts. If you start by just going to the frontpage it will all be about Umbraco 7 and the new API's.
Hope this can help a bit afterall?
/Jan
is working on a reply...