W
W
weranda2015-06-08 00:07:13
MODX
weranda, 2015-06-08 00:07:13

How to pass the url value after the pound sign # in Formit?

Greetings.
The page contains a link leading to a separate form page. The form page is linked to from different pages. Form links have a common form in the template and look like this:
<a href="form#">Ссылка на форму</a>
The default URL of the form is:
http://site.ru/form
When you click on the link leading to the form, the URL is: The
http://site.ru/form#previous_url
question is the following. How to read the last and full URL address and send it in the email when submitting the form, so that you can understand on which page the application button was clicked? Those. not only site.ru/form , but also/inclusive after the pound sign - site.ry/form#previous_url
Perhaps there are already similar solutions. Unfortunately, you don't want to make a form directly on the page because of the design of the page itself; I also don’t want to make a form in a pop-up window, especially since getting the URL address of the form from the page of which it was activated, located in another document, also causes similar difficulties.
What options are available?
I would appreciate any helpful advice or solution.
Explanation
There are pages with the following addresses:

site.ru/page1
site.ru/page2
site.ru/page3
...
site.ru/page100

They have links to the form, located in a separate document at:
site.ru/form
Each link leading to the form has the URL of the current page added to the href link attribute. In general, links to the form from different pages look like this:
site.ru/form#page1
site.ru/form#page2
site.ru/form#page3
...
site.ru/form#page100

When navigating to the form page, the URL looks like the above. You need to somehow catch the URL parameters after the pound sign when submitting the form and pass this value - the entire URL with data after the pound sign.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanes, 2015-06-08
@Sanes

This is the resource id.
Forms don't count at all. Google, anchor link!

R
Ruslan, 2015-06-08
@ruslan_aleev

As an option - you pass the get-parameter in the link, i.e. the link will be like this <a href="form?page_id=2">Ссылка на форму</a>
Then you create a "my_id_page" snippet, like this:

<?php
$pageID = strip_tags($_GET["page_id"]);
echo $pageID;
?>

and you put the snippet itself, for example, into a hidden form field <input value="" hidden/>
. you will receive an id from the page from which the button was clicked, you can also send other parameters, for example, the title of the page.

K
kpot1979, 2015-06-24
@kpot1979

There is a geturlparam add-on that allows you to add parameters to the URL and pass them to any resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question