Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Roger 195 posts 474 karma points
    Apr 23, 2013 @ 16:12
    Roger
    0

    Form to write notes to a node

    Hi all,

    I'm not sure if i'm posting this in the right section.

    I need to have a form on the front end of the site that will write to a node in the admin area.

    It's basically a note about an account. The heirarchy is as follows:

    Accountant
    >> Company
    >>>>Client
    >>>>Client
    >>>>>>>>Note
    >>>>>>>>Note
    >>>>>>>>Note

    I need to have the client, from a form on their profile page on the front end, to be able to write a note against themselves and have it publish under the Client node as per the heirarchy above.

    I'm guessing I need a document type firstly with the author name, date and note (as textarea) but what would I need in the usercontrol to allow the form to write a note to the client node?

    Can someone please help?

  • Roger 195 posts 474 karma points
    Apr 23, 2013 @ 16:25
    Roger
    0

    Im wondering, can Contour do this?

  • Roger 195 posts 474 karma points
    Apr 25, 2013 @ 13:36
    Roger
    0

    Can anyone advise how to do this from a usercontrol???

  • Brendan Rice 538 posts 1099 karma points
    Apr 29, 2013 @ 19:06
    Brendan Rice
    0

    There is an excellent tutorial at the URL below:

    http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/working-with-data/creating-data-programmatically/TVPlayer

    I would recommend purchasing a subscription for the videos as they will walk you through most of what you need to do in Umbraco.

    A good reference is also the documentation on our.umbraco.org, below is a link to the API class that should help you do what you need:

    http://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService

    Give this a go and f you are struggling with anything just ask.

  • Roger 195 posts 474 karma points
    Apr 30, 2013 @ 12:37
    Roger
    0

    Hi Brendan,

    Thanks for the help.

    Its a basic text field and textarea that needs to write a note under a parent node. The parent node of the current page the user is logged into (their account effectively)

    The usercontrol would need to pick up the nodeID from the currentPage.

    Once submitted, it would write content to the node using the 'notes' document type, publish it and send an email to the admin to alert them that a new note has been added.

    Before I go ahead with subscribing, is this simple enough to do?

    Thanks again

  • Roger 195 posts 474 karma points
    Apr 30, 2013 @ 14:14
    Roger
    0

    Hi Brendan,

    I subscribed to the videos but the control for adding content programmatically doesnt work with the latest version of umbraco. It gives build errors and falls over when trying to run the page withthe macro. I feel like i've just wasted 23 euros :(

    Any other ideas?

  • Brendan Rice 538 posts 1099 karma points
    Apr 30, 2013 @ 20:28
    Brendan Rice
    0

    Hi Roger, can you post any pictures of the errors you are getting? 

    If you are using the latest version of Umbraco the code below should work, you will just need to query to get the parentNodeId.

    Hopefully this helps. I have been watch a few of the videos and I still think they are relevant as they explain a lot of core concepts. They may be a little out of date as Umbraco development is moving quickly. UMbraco HQ are working on the Beta for UMbraco TV and I think you will find a lot of helpful tutorials on there as well (your login should let you vie wthe videos), you can find it at http://beta.umbraco.tv/.

    If you need any more help or advice please just ask.

     

                //get the content service from this.UmbracoContext.Application.Services
               var contentService = UmbracoContext.Application.Services.ContentService;

                
    //Create content, pass in the parent id and the document type alias.
               var contentNode = contentService.CreateContent("Name of your node", parentNodeId, "documentTypeAlias");

                
    //Set the propeties on the contentNode
               contentNode.SetValue("youPropertyAlias1", "value1");
               contentNode.SetValue("youPropertyAlias2", "value2");
               contentNode.SetValue("youPropertyAlias3", "value3");

    //Now we need to save and publish the node
    contentService.SaveAndPublish(contentNode);

     

  • Roger 195 posts 474 karma points
    Apr 30, 2013 @ 21:51
    Roger
    0

    Thanks Brendan,

    That makes more sense!

    I'll give it a try. Again, many thanks for the help

    Roger

Please Sign in or register to post replies

Write your reply to:

Draft