Keep track of the pages where the form submission came from

Permalink
If we use a form on multiple pages (like in global areas), what's the most appropriate to keep track on which page the submission came from?

PS: using 5.7.4.2 at this moment.

madalin
 
zuna replied on at Permalink Reply
Hi, when i had the same problem i spoke with J. Fish and his magic data with magic form work perfect for this.
zuna replied on at Permalink Reply
Hi, when i had the same problem i spoke with J. Fish and his magic data with magic form work perfect for this.
madalin replied on at Permalink Reply
madalin
Thank you for the tip.

Meanwhile I've extended the core Form builder and managed to get the necessary additional data in results.

Really Concrete5's code base is awesome and easy to understand for any good php developer :)
JohntheFish replied on at Permalink Reply
JohntheFish
The basic solution is in this howto:
http://www.concrete5.org/documentation/how-tos/designers/record-the...

Amongst many other enhancements, Magic Data Forms provides a more secure implementation of what the howto describes.
http://www.concrete5.org/marketplace/addons/magic-data-forms/...
madalin replied on at Permalink Reply
madalin
Thank you John.

Good article, nice to see it's by yourself.

We took another approach and solved it as mentioned above.
malkau replied on at Permalink Reply
malkau
I do this too, as I put a form on each page of the site, and it's handy to know what page they submitted from because sometimes we get submissions like: "please send me price for this" and they haven't specified what they are talking about!

We pull the page URL into the email result via server-side too (my husband set it up, so I am not sure the specifics :)

I'd love to have this as feature as an option in the core form block... the ability to just tick a box that says "Show submission page URL in results" and it shows it in the email AND even on the dashboard form results.

I might put a feature request later... I need to head offline at the mo :)
JohntheFish replied on at Permalink Reply
JohntheFish
Taking the solution in the howto as a starting point, this could be achieved by changing it to
$('#Question12').val(document.href);

or
$('#Question12').val(document.title);
madalin replied on at Permalink Reply
madalin
by using the "questions" you're not providing flexibility to have it on more forms on the website.

a very simple way would be to target an input text block with a custom label set and target that input in javascript to hide it and set it's value to the Page url.

that way it could be used on any form that has that specific field.
JohntheFish replied on at Permalink Reply
JohntheFish
Yes, targetting the jQuery at a standardised question name rather than a specific number would be a useful extension of the trick.
madalin replied on at Permalink Reply
madalin
I was thinking better on an extension that solves even better without JavaScript and anything outputted on the Front-end. I'll plan and see if I can get with a stable release in the next couple of weeks.

PS. Will be my first published add-on, for free.
JohntheFish replied on at Permalink Reply
JohntheFish
The hazard with anything that adds the page ID or name using a hidden form field is that a mildly knowledgeable visitor can hack it. That applies whether the hidden field is filled with javascript or php.

Marketplace forms packages tag form data with the originating page on saving to the database and its the report viewer that then translates the tag into the page name or path.

It would be good to see the core forms package enhanced throughout to do that, rather than the diversity of solutions that get tacked on afterwards.
madalin replied on at Permalink Reply
madalin
I guess you are right.

Could you guide me for any information related if the project managers accept on Github pull requests with enhancements or other specific rules for the core?
JohntheFish replied on at Permalink Reply
JohntheFish
As a core update, the tricky part will be with the database tables. You would be adding a new column to one of them. As its a core table, that makes it difficult to build this as an addon that could subsequently become a core update.

- As an addon, you could simply create a new table to associate form answer ID with cID.
- As a core update, that would be inefficient when it could easily be an extra column on the table of answer IDs.