Copied to clipboard

Flag this post as spam?

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


  • Sprite 18 posts 158 karma points
    Mar 18, 2020 @ 07:53
    Sprite
    0

    Getting entered email in thank you page

    Hello,

    I am using umbraco forms. And what i am trying to achieve is to let the customer go to a thank you page. And with that page i want to be able to get the filled in email address on that page aswell.

    I need that email address on the same page the customer goes to. So that i can send it also to tradetracker along with the cookie of the current user.

    i have tried to give it parameters but the submit message / go to page function does not allow me to insert parameters for the page i am sending the customer to.

    I hope i am clear enough of what i am trying to do and somebody has any idea on how i can do this.

  • Julien Kulker 75 posts 427 karma points c-trib
    Mar 18, 2020 @ 11:17
    Julien Kulker
    100

    Hi, I did some testing with the documentation on this page: https://our.umbraco.com/documentation/Add-ons/umbracoforms/developer/working-with-data/

    I did manage to create some snippet and i hope this will start you out.

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.Index>
    @using ContentModels = Umbraco.Web.PublishedModels;
    @using Umbraco.Core;
    @using Umbraco.Core.Composing
    @using Umbraco.Forms.Core.Services
    @{
    Layout = null;
    }
    @{
       var recordReaderService = DependencyResolver.Current.GetService<IRecordReaderService>();
       var recordID = (Guid)TempData["Forms_Current_Record_id"];
       var records = recordReaderService.GetRecordsFromForm(new Guid("20e9ddb3-85f9-4a0d-adbc-d296811e3eaf"), 1, 1000);
       var currentRecordData = records.Items.Where(record => record.UniqueId == recordID).FirstOrDefault();
    }
    <div>
      @recordID
      @currentRecordData.UniqueId
    </div>
    

    I did find some flaws in the documation.

    1. The signature for formId is changed to a guid. documentation says it is a string.(Created a pull request for this one)

    2. When pageNumber= 0 we do get a out of index message. So i did set this to 1 instead of 0

    Greetz Julien

    PS: if this is the answer you where looking for please markt it as the answer

  • Sprite 18 posts 158 karma points
    Mar 18, 2020 @ 14:19
    Sprite
    0

    Hello Julien,

    This was exactly what i was looking for but could not find. I managed to use your snippet and got the unique id correctly.

    After that i managed to get the custom values like name and email address with the following:

    @currentRecordData.ValueAsString("emailadres") @currentRecordData.ValueAsString("name")

Please Sign in or register to post replies

Write your reply to:

Draft