Copied to clipboard

Flag this post as spam?

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

  • Josh Reid 182 posts 257 karma points
    Jun 07, 2012 @ 04:17
    Josh Reid

    Delete record stops forms editing until new records have been added

    Umbraco 4.7.2 + Contour 1.1.12

    I have been creating a user generated content system using Contour and have got everything in the creation/management 'toolbox' sorted, but if I delete a record (front-end as user), when I open to edit another still existing record, the form is blank, eg: no editing capabilities, or existing record values ouput to the form.

    When I create new content and approve the record, the forms all are populating as normal. It's like the delete somehow knocks out the connection to the renderform macro? Or at least the AllowEditing property??? Also tried while front-end form edit doesn't work, i can still edit the record through back-office contour > previewFormDialog as usual.

    Has anyone experienced this? Any thoughts appreciated ;)


    Code for delete looks like this:

    public void doDelete()
        bool del = false;
        if(Request.QueryString["recordGuid"]!=null && IsGUID(Request.QueryString["recordGuid"])) {
          Guid rGuid = new Guid(Request.QueryString["recordGuid"]);
          Umbraco.Forms.Data.Storage.RecordStorage storage = new Umbraco.Forms.Data.Storage.RecordStorage();
          Umbraco.Forms.Core.Record record = storage.GetRecord(rGuid);
          Umbraco.Forms.Core.Services.RecordService rs = new Umbraco.Forms.Core.Services.RecordService(record);
          if(record.GetRecordField("node").ValuesAsString()!="") {
            Document doc = new Document(Convert.ToInt32(record.GetRecordField("node").ValuesAsString()));
            del = true;
            Response.Redirect("?note=Record has been deleted");
          Response.Redirect("?error=Delete failed");

    Code on page:

    <% if(Request.QueryString["recordGuid"] != null && canEdit) { %>
          <a class="button delete confirm" title="Delete the Band" href="?recordGuid=<%= Request.QueryString["recordGuid"]%>&amp;delete=true">
        <legend>Edit the band details of... "<%= band %>"</legend>
        <umbraco:Macro FormGuid="9e79f071-1ce8-46b2-81f0-1f489e4d69bf" AllowEditing="1" SubmitButtonText="Preview" Alias="umbracoContour.RenderForm" runat="server"></umbraco:Macro>
    <% } %>
  • Josh Reid 182 posts 257 karma points
    Jun 20, 2012 @ 03:26
    Josh Reid

    I have finally found the answer to this (slightly obscure and maybe unique) issue here: THANKS TIM!!!

    It relates to leaving the state of the deleted record form in limbo, ie: opened ready for return editing, but we've just deleted the entry so of course we cant resume when we return, as it no longer exists.


    Here is the snippet you can use (just make sure to set the correct form guid):

    <script runat="server">
        protected override void OnLoad(EventArgs e){
            if (!IsPostBack)
                int pageId = umbraco.presentation.nodeFactory.Node.GetCurrent().Id;
                string formId = "204188fc-509e-43e2-b04e-dcfde2e62158";

                if (Request.Cookies["contour_"+pageId+"_" +formId] != null)
                    var contourCookie = Request.Cookies["contour_"+pageId+"_" +formId];
                    contourCookie.Expires = DateTime.Now.AddDays(-1d);

Please Sign in or register to post replies

Write your reply to: