• Resolved Jo Waltham

    (@jowaltham)


    Hi. I’m creating a form that asks people to update the information on the page (a custom post type). I have a hidden Embed URL field but in the email it is sending the referrer URL (ie the CPT archive) rather than the current url the form is located on.

    I see the forminator_get_current_url function uses wp_get_referer() to get the referer, and then url_to_postid to get the post id, and then uses get_permalink on the post_id to get the url.

    If I go to the page with the form on it, from another page then I get the referer but if I just load the page with the form on it then then I do get the current url.

    Is there another way I can get the URL of the page/post/cpt that the form is located on into the email?

    Also is there a way to see the url in a form field when the form is displayed on the page (ie show the hidden field)? I note that url is not an option in the Post Data field.

    • This topic was modified 1 year, 8 months ago by Jo Waltham.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @jowaltham ,

    Your site is under “Coming soon” so I couldn’t check how it works. Is the page with the form loaded with Ajax when coming from CPT archive page?

    Also is there a way to see the url in a form field when the form is displayed on the page (ie show the hidden field)? I note that url is not an option in the Post Data field.

    You can use the HTML field as it has similar options as the Hidden field:

    https://www.evernote.com/shard/s134/sh/52002272-1fe1-4830-bce2-dd15bf6f38bf/0unpRpSyQhVsI6SsOJ7MD0lWVRPxLt1_IudsF-eyuhv-oSBX9oLF00KOeA/deep/0/image.png

    kind regards,
    Kasia

    Thread Starter Jo Waltham

    (@jowaltham)

    Hi Kasia

    My apologies, I forgot about the Coming Soon page. I’ve copied the website to staging and removed the Coming Soon.

    Go to https://staging.adderleyheritage.co.uk/the-collection/ and click on any collection item listed below the search form. On the single collection item page you will see the Forminator form in a grey box under the image and data. I’ve added an html field with {embed_url} so you can see the embed_url is returning the “Search The Collection” page url (/the-collection/) and not the url of the collection item. If you reload the collection item page then the embed_url is the current page.

    If you complete the form a copy of the data, including the hidden fields, are emailed to you so you can see that it is not giving the url of the page where the form is embedded.

    I have the form submitting using AJAX, I’ve also switched that to Page Reload and get the same result in the email (ie the referer page url is returned not the current url)

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @jowaltham,

    Wouldn’t you mind please share an export of the form so that we could give a closer look at the issue? Please use Google Drive or Pastebin.com to share the export of the form.

    The following documentation can help you with exporting a Forminator form: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    We look forward to hearing back from you.

    Kind Regards,
    Nebu John

    Thread Starter Jo Waltham

    (@jowaltham)

    Hi Nebu

    Here is a pastebin of the export of the form:

    https://pastebin.com/T5YrjwC0

    Thanks

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @jowaltham

    Thanks for sharing the form.

    I checked it on my own test site and I couldn’t replicate the issue there.

    I could replicate it in a way on your test site but I also noticed something additional:

    – you mentioned that when the form shows wrong URL (visited from other page) reloading it fixes it
    – but it wasn’t my experience; for me reloading (regular or even “hard refresh”) didn’t fix this at all

    – until I actually tried to “break the cache” by adding a random URL parameter to the URL.

    Note also how the page loads/renders almost instantly. This is fine but I’m nearly sure that this is a matter of caching. I can see that you have “Prevent page caching on form page” option enabled but this only works with caching tools (plugins or other) that respect the DONOTCACHE constant – not all of them, especially not a server-level cache, do that.

    Please try this then:

    1. additionally, enable the “Load form using AJAX” option in form “Behavior” settings
    2. update the form
    3. and after that clear all cache on site and double-check your hosting – there may be some cache active there

    If that doesn’t solve the issue, let us know and we’ll consult our developers on this.

    Best regards,
    Adam

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @jowaltham

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hidden Embed URL field giving referrer URL not current URL’ is closed to new replies.