Copied to clipboard

Flag this post as spam?

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


  • Jonas Nilsson 137 posts 260 karma points
    Aug 22, 2013 @ 11:19
    Jonas Nilsson
    0

    Edit existing post

    Is there any simple way to load an existing record / form by it's record id (user should be able to edit his posts)

    Have seen some topics about this, but not any solutions.

    /Jonas

  • Comment author was deleted

    Aug 22, 2013 @ 12:17

    Yeah just feed it the record id :) are you using the razor macro then simply append ?recordGuid=anid to the query string and you should see the macro in edit mode :)

  • Scott 95 posts 277 karma points
    Sep 21, 2015 @ 15:26
    Scott
    0

    Tim what about for the new Umbraco Forms? I've been trying to feed it with the recordGuid, however, it does not seem to work.

    I am using 7.3 and 4.1.4

    UPDATE: I actually managed to do it by adding recordid instead of recordGuid!

  • Dale McCutcheon 32 posts 135 karma points
    Mar 28, 2018 @ 13:29
    Dale McCutcheon
    0

    Scott how did you get it to work with Record id i have tried both but neither are working for me?

  • Dale McCutcheon 32 posts 135 karma points
    Mar 28, 2018 @ 13:31
    Dale McCutcheon
    0

    Tim i'm using 7.10 umbraco and 7.0.1 umbraco forms and can't seem to populate my form with a record using ?recordId or recordGuid, any ideas?

  • Scott 95 posts 277 karma points
    Mar 28, 2018 @ 18:32
    Scott
    0

    Hi Dale

    I did like this:

    EditUmbracoForm

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @using ClientDependency.Core.Mvc;
    @using Umbraco.Forms.Mvc.DynamicObjects
    @using Umbraco.Forms.Core
    @using Umbraco.Forms.Core.Services
    @using Umbraco.Forms.Data.Storage
    
    @{
        Response.Cache.SetNoStore();
        var fuid = Model.MacroParameters["FormGuid"];
        var ruid = Request["recordid"];
        DynamicRecordList records = Library.GetRecordsFromForm(fuid.ToString());
    }
    <select onChange="location.href='?recordid='+this.value">
        <option value="">Select record</option>
     @foreach (dynamic record in records)
     {   
         try {  
        <option value="@record.Id" @(record.Id == @ruid ? " selected" : "")>@record.Id</option>
         }
         catch (Exception ex) 
         {
             @ex.Message
         }
      }
    </select>
    
    @if(!String.IsNullOrEmpty(ruid))
    {
        if (fuid != null)
        {
            var s = fuid.ToString();
            var g = new Guid(s);
    
            Html.RenderAction("Render", "UmbracoForms", new {formId = g});
        }
    }
    

    I have edited my example so maybe it needs tweaking, I haven't tested it but it is taken from a working code.

    Don't know if you can use it, if not let med know, maybe you can show us what you have done to be able to assist you.

  • Scott 95 posts 277 karma points
    Apr 03, 2018 @ 10:51
    Scott
    0

    Dale did you get it to work?

  • Comment author was deleted

    Aug 22, 2013 @ 12:19

    And to get the records from a certain member

    var AllEntries = Umbraco.Forms.Mvc.DynamicObjects.Library.GetRecordsFromForm("Big Fat Form Id - Guid"); var myKey = Membership.GetUser().ProviderUserKey.ToString(); var entries = AllEntries.Items.Where(i => i.MemberKey.ToString() == myKey).ToList();

    @foreach (var record in entries) {

    }

  • Jonas Nilsson 137 posts 260 karma points
    Aug 23, 2013 @ 08:49
    Jonas Nilsson
    0

    Great!, that worked!

Please Sign in or register to post replies

Write your reply to:

Draft