Send URL of page the form was submitted on

Wayne Gowers created the topic: Send URL of page the form was submitted on

Hi We'd like a simple "Request info" button for a web catalog. We need the url of the page that the button was pressed on to appear in the email that was sent.

How do I include the page url in the info emailed with the form?

#47153

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: Send URL of page the form was submitted on

Dear Wayne,

You will need to write a few lines of jQuery code in Form Options > Javascript tab to get the page URL. Also, please place a hidden field, to which the code will add the link.

Here's the approximate code you will need to use:

var pathURL = location.pathname;
jQuery('#hidden_field_id').val(pathURL);

Where hidden_field_id is the exact ID of your hidden field. You can get it from frontend of your form, using developer tools of your browser.

Thank you!


Kind regards,
Agapi G.
Web-Dorado team
#47221

Please Log in or Create an account to join the conversation.


andrey replied the topic: Send URL of page the form was submitted on

I created hidden field


Field Name : pathURL

Field Value : pathURL


Find out the hidden_field_id "wdform_7_element1", using developer tools of my browser.


Open Form Options > Javascript and place the code

// Occurs before the form is loaded
function before_load()
{
var pathURL = location.pathname;
jQuery('wdform_7_element1').val(pathURL);
}

// Occurs just before submitting the form
function before_submit()
{

}

// Occurs just before resetting the form
function before_reset()
{

}


The result I received after submitted a form:

E-mail: [email protected]

Message: TEST

pathURL pathURL


So, the page URL was not shown up.

What did I do wrong ?

#48687

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: Send URL of page the form was submitted on

Dear Andrey,

Firstly, make sure to leave the Value option of your hidden field blank. This way only the URL will be written with Javascript, but in case you write something, it might keep it and make it look weird.

And secondly there is a small mistake in your jQuery code. You forgot to add # sign before your hidden field ID. Please do that, so the code looks like this:

var pathURL = location.pathname;
jQuery('#wdform_7_element1').val(pathURL);

Thank you!


Kind regards,
Agapi G.
Web-Dorado team
#48751
The following user(s) said Thank You: andrey

Please Log in or Create an account to join the conversation.


Michael Hill replied the topic: https://mlc-cad.biz/home/industries

For the life of me I can't find out the correct ID for the hidden field using Google's developer's tools. Can you please assist me? The hidden pathURL field is after the message and before ReCaptcha

mlc-cad.biz/home/industries

#64864

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: https://mlc-cad.biz/home/industries

Hi Michael!

Thank you for posting your request! The ID of your hidden field is #wdform_20_element12 so the code for your form would be:

var pathURL = location.pathname;
jQuery('#wdform_20_element12').val(pathURL);

Thank you! Have a great day!


Kind regards,
Agapi G.
Web-Dorado team
#64904

Please Log in or Create an account to join the conversation.


Time to create page: 0.200 seconds
Powered by Kunena Forum

WORLD-CLASS SUPPORT

We are here for you every step of the way. Turn to our support with any questions you might have about our products and services. Our experienced customer care team is available to help you as fast as we possibly can.

Contact us