Copied to clipboard

Flag this post as spam?

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


  • Frans de Jong 550 posts 1862 karma points MVP 4x c-trib
    Jul 27, 2015 @ 11:25
    Frans de Jong
    0

    Use current form entry on thank you page [Solved]

    Hi all,

    I'm am making a product advise site. I have made a multipage form with umbraco forms and on submit I redirect users to a page where I need the form values from this client and process them to give the advice.

    I can't find how to get to the form data. There are all kind of snippets on our umbraco but nothing seems to work with forms and umbraco 7.2.2

    For testing purposes I made a form with one text input called Name. I want to show the name on the thank you page.

    Can somebody point me in the right direction?

    Thanks!!

    Edit: I think the main problem in all the code snippets I find is the use of a GUID. I don't have a clue where to find the form GUID...

  • Frans de Jong 550 posts 1862 karma points MVP 4x c-trib
    Jul 27, 2015 @ 12:50
    Frans de Jong
    0

    Ok, I got this snippet to work in a partial view:

      @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    
    @using Umbraco.Forms.Mvc.DynamicObjects
    
    <div class="container">
    
     @foreach (dynamic record in Library
               .GetRecordsFromForm("6bf71d72-5186-416f-b0bb-0bedac65d66a"))
         {
            <div class="row">
                <div class="col-xs-12">
                    <h2>@record.Naam</h2>
                    <p>@record.Created.ToString("dd MMMM yyy")</p>
                    <p><strong>@record.Leeftijd</p>
                </div>
            </div>
          }
    </div>
    

    I found the GUID in /App_Plugins/UmbracoForms/Data/Forms.

    This snippet gives me all the entry's. What I need is the entry I just submitted like described here: enter link description here

  • Comment author was deleted

    Aug 03, 2015 @ 10:44

    You can get the id of the latest record, that's stored in the tempdata collection

  • Frans de Jong 550 posts 1862 karma points MVP 4x c-trib
    Jan 29, 2016 @ 08:59
    Frans de Jong
    0

    Hi Tim,

    I updated Umbraco forms to the latest version and now this:

    if (TempData["umbracoformsform"] != null && TempData["Forms_Current_Record_id"] != null)
        {
            var currentForm = (Umbraco.Forms.Mvc.Models.FormViewModel) TempData["umbracoformsform"];
            var currentRecordId = TempData["Forms_Current_Record_id"].ToString();
    

    doesn't work anymore. Has anything changes in the latest version due to the security patch?

    Thanks

  • Frans de Jong 550 posts 1862 karma points MVP 4x c-trib
    Aug 06, 2015 @ 11:50
    Frans de Jong
    0

    Hi Tim,

    I solved the problem by getting the Guid from the TemData. Using the Guid I loop throught all the entry's and pick the one with the Guid from tempdata.

    It works like this.

    Thanks for the help

  • Adriano Fabri 469 posts 1633 karma points
    May 20, 2016 @ 11:38
    Adriano Fabri
    0

    can you write the code, because I have some problems.

    thank you

  • Frans de Jong 550 posts 1862 karma points MVP 4x c-trib
    May 20, 2016 @ 11:44
    Frans de Jong
    0

    Hi Adriano,

    I now use:

        var record = RecordService.Instance.GetRecordFromTempData(TempData);
    

    That gives me the latest record from tempdata. Please let me know if this works.

    Frans

Please Sign in or register to post replies

Write your reply to:

Draft