Copied to clipboard

Flag this post as spam?

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


  • Andrew 32 posts 52 karma points
    Feb 11, 2010 @ 22:11
    Andrew
    0

    Change status of a form submission

    Is there a way to change the status (or change/create other information) stored in a form record?  I am trying to display the data entered into a form in a pleasing manner for someone to review the submission and decide whether to accept or reject it.  I am displaying the form data through an xslt file.  Would there be a way to create "accept" and "decline" buttons on the page which could change the status of the record?  Thanks for the help.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 12, 2010 @ 10:19
    Ismail Mayat
    0

    Andrew,

    No exactly contour related but i had a similar thing. I had form created using doc2form.  I had status tab with drop down on it Processed,Reject,Spam.  I created an action handler that would after changing status and save would move the form into sub folder Proccessed, Spam,Reject depending on selection.

    Regards

    Ismail

  • Harald Ulriksen 207 posts 249 karma points
    Feb 12, 2010 @ 11:24
    Harald Ulriksen
    0

    Andrew, this is fully possible - however it will require a change from xslt to some user controls.

    What you can do is to leave the record just submitted, i.e. not approved. You can then use a usercontrol with an asp:repeater to list the records (you can bind to xpathnavigator) and buttons for accept/decline. In the code behind for the buttons you can open the record and approve or delete it - or modify it's contents.

    I've just done this myself so please do not hesitate to ask for further details if this is unclear.

    Harald :-)

  • Andrew 32 posts 52 karma points
    Feb 15, 2010 @ 22:37
    Andrew
    0

    Thanks for the useful suggestions.  I have created a user control and opened the form using Umbraco.Forms.Library.GetRecordsFromForm.  From there, I have figured out how to diplay the form data using asp:Repeater.  I am having some trouble figuring out how to modify the form data.  Particularly, I would like to add a node to each record which would be named "status" which I could then manipulate (change to "accepted", "declined", "pending", etc).  I'm really new to all of this and could use some hints as to what functions to call.  Particularly, how do I add a new node to each record and save that to the form data?  I have been looking at the Contour Developer Document, but I can't seem to find the function that I am looking for.  Is there another reference that would tell me what functions are available?  Thanks for your help!

  • Harald Ulriksen 207 posts 249 karma points
    Feb 16, 2010 @ 13:06
    Harald Ulriksen
    0

    You cannot really add a new node to a Contour record (unless stored as a node). If we stick to strictly contour you can either use the built-in contour status or add a custom field - with prevalues for the various states.

    The field can either be a custom field type, hence hiding it from the user or you can use javascript to hide a dropdown field client side. 

    When you have a custom field up and running we can set a default value using a workflow. You can then update the status record field later on using your user control.

    Unfortunatly there's not much documentation besides the developer document, but I'll post a member create workflow and one on creating your own records.






  • Andrew 32 posts 52 karma points
    Feb 16, 2010 @ 19:46
    Andrew
    0

    Hi Harald,

    Thanks for your help.  I think that the best way to go would be to just change the built in "state" property of a record.  How do I open an individual record  in my member control and change the properties? 

    Thanks,

    Andrew

  • Andrew 32 posts 52 karma points
    Feb 18, 2010 @ 15:13
    Andrew
    0

    Does anyone know how to open a record (if you know the record id string) and change the state?  Thanks for your help.

  • Harald Ulriksen 207 posts 249 karma points
    Feb 18, 2010 @ 17:54
    Harald Ulriksen
    0

     

    Something in the line of this should work (written in notepad, untested).

    Umbraco.Forms.Data.Storage.RecordStorage storage = new Umbraco.Forms.Data.Storage.RecordStorage();
    Umbraco.Forms.Data.Storage.FormStorage formStorage = new Umbraco.Forms.Data.Storage.FormStorage();


    Umbraco.Forms.Core.Record record = storage.GetRecord(new Guid(yourStringGUID));
    Umbraco.Forms.Core.Form form = formStorage.GetForm(record.Form);
    Umbraco.Forms.Core.Services.RecordService service = new Umbraco.Forms.Core.Services.RecordService(record);
    record.State = Umbraco.Forms.Core.Enums.FormState.Approved;
    storage.UpdateRecord(record,form);
    service.SaveRecord();


    As far as I can remember you don't need service.SaveRecord unless you need to trigger a workflow, but since I'm not 100% sure I suggest you test just UpdateRecord, just SaveRecord and both to see what you need and to be on the safe side.
     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft