This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Adding Hidden Variables to MachForms
Started 16 years ago by MrLinguaFranca | 5 posts |
-
Hello all,
I've just started using MachForms and am up and running but need your help with something. Sending forms is seldom just a one page but requires passing variables from one page to another. On the previous page the user selects a date range and then they click 'Continue', whereupon they're taken to my registration form (created on MachForm). I need my MachForm to pick up that date variable from the previous page because I want it to appear in the resultant mail.
I read a post here that suggested selecting the 'Admin Option' could be used to make a hidden form field but I haven't had any luck with this. They simply keep appearing as text fields.
So, does anyone know how to do this?
Thanks in advance.
Pete.
Posted 16 years ago # -
Hi Pete,
How you parse the data from previous form to registration form ? do you use "GET/POST" method ? If it's so let say you have "registration form" with this url :
"http://www.yourdomain.com/registration.php"
I assume you send GET data from your previous form, the url should be like this :
"http://www.yourdomain.com/registration.php?data=2009-01-01"
To get that variable data, you should edit "view-functions.php". If you consider you use "text field" you can go to around line 40, you will see this code :
$element_markup = <<<EOT
put this code exactly above that line
if (!empty($_GET['data']) && $element->id == '1' && $_GET['id'] == '2') { $element->default_value = $_GET['data']; }
in there I assume text element id = '1' in form id = '2', make sure you've change with yours
MachForm Support
Posted 16 years ago # -
Hello,
I know this is an old thread, but I'm attempting to do the same thing and can't quite get it to work.
I have two hidden fields set up on my form using the css class "hidden". I need these fields to auto fill information from the url.
Example url: www.Ignite-Edu.net?source=AdWords&keyword=KEYWORD
I've modified the "view-functions.php" file by adding the following code directly above the line containing
$element_markup = <<<EOT
if (!empty($_GET['keyword']) && $element->id == '1' && $_GET['id'] == '7'){ $element->default_value = $_GET['keyword']; } if (!empty($_GET['source']) && $element->id == '1' && $_GET['id'] == '6'){ $element->default_value = $_GET['source']; }
Form ID is 1
keyword field is 7
source field is 6The form can be seen here: http://envistaacademies.com/machform/view.php?id=1
I've tested this a few times and can't get the hidden fields to pull the keyword or source from the url string.
Any help you can offer is appreciated!
Posted 12 years ago # -
No need any modification for this. As of v3.2 you can do this already:
http://www.appnitro.com/doc-url-parameterMachForm Founder
Posted 12 years ago # -
I'm not sure this is the right solution for me. I won't know what the values will be in the url string. They'll be different for every user (search terms used to find the form).
Posted 12 years ago #
Reply
You must log in to post.