Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

Copied to clipboard

Flag this post as spam?

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

  • Bijesh Tank 184 posts 411 karma points
    Aug 18, 2016 @ 08:47
    Bijesh Tank

    Capture current page name on submission


    I have a form that is reused on quite a few pages and we would like to capture the page where the form submission has come from, and then show the entry (in the backoffice) with the page name. Is this possible?

    I was thinking about including a hidden field as part of the form as a new question in the backoffice but then how can I pass the current page name to that hidden field?

    Thanks, B.

  • Warren Buckley 2059 posts 4398 karma points admin mvp hq c-trib
    Aug 18, 2016 @ 14:26
    Warren Buckley

    Hi Bijesh,
    We log the node ID of the page for the submission, but currently do not display the page name or URL that it was posted from.

    You could use a hidden field as you describe and use a default value in the field along with the Forms syntax. Hopefully this should be enough to achieve what you need to do.


    Warren :)

  • Bijesh Tank 184 posts 411 karma points
    Aug 18, 2016 @ 15:10
    Bijesh Tank

    Thanks for the pointer Warren!

    Works like a charm :)

  • Mads Sørensen 162 posts 346 karma points
    28 days ago
    Mads Sørensen

    Hi Warren - is it possible for you to explain this a bit?

    I've have tried ti paste this into the default value field but with no luck:



    But that dosent seem to do the job.

    What am I doing wrong?enter image description here

  • jonok 244 posts 437 karma points
    Jun 07, 2017 @ 23:09

    I'm currently trying to do this in Umbraco Forms - but I don't understand Warren's instructions. Is there an easy way to display the page name in the email subject or body? This is important, as my client wants to know which pages are being used to submit a single form that appears throughout the website.

  • Martin 241 posts 538 karma points
    Jul 11, 2017 @ 13:10

    Hi, @Bijesh & @jonok, did you get the page name returned in the form entry?

    Thanks M

  • jonok 244 posts 437 karma points
    Jul 11, 2017 @ 23:00

    Hi Martin, I ended up getting it to work by doing the following (it's a bit convoluted)...

    Add a metatag to the head of each page, and insert the page name into the 'content' of the metatag:

    <meta name="" content="@Model.Content.Name">

    Then in Umbraco Forms, I include a question of type 'hidden' in each of the forms, and I give the question a title of 'Page Name'.

    Then in the footer of each page, I use jquery to get the page name from the metatag and insert it into the hidden form input:

    if($('.pagename').length) {
          var pageName = $("meta[name='']").attr('content');
          $(".pagename input").val(pageName);

    Now when the form is submitted, the page name is included in the email along with the rest of the form data.

    It's not the most elegant solution, but it works - which is the important thing.

Please Sign in or register to post replies

Write your reply to: