Passing an external value to a Custom form

We use Campaign Monitor to manage a number of e-newsletters to which our clients can subscribe.


When a client chooses to unsubscribe, they click on an "Unsubscribe" link at the bottom of the e-newsletter, which unsubscribes them from the subscriber list and also sends them to a Matrix "Unsubscriber survey" Custom Form, where they can submit a reason for why they've chosen to unsubscribe from an option list, or via a free text field. Because we have several (over 5) e-newsletters being managed via Campaign Monitor, we have a corresponding number of separate "Unsubscriber Survey" forms set up in Matrix, one for each of the e-newsletters.



We were just wondering whether or not it would be possible to have just the one "Unsubscriber Survey" form for use with all e-newsletters, no matter how many of them might be set up in the future. What we want to avoid, if possible, is having to include an option list in the Custom Form that would list the various e-newsletters, forcing the unsuscriber to have to select one. It would be much better if the name of the particular e-newsletter being unsubscribed from could be somehow included in the form submission automatically (e.g. via a hidden field) when the "Unsubscribe" link was clicked back in the e-newsletter itself, in some way.



Unfortunately I can't see any way of including a hidden field within a Custom Form, or a way of automatically including the e-newsletter's name as the value of such a field.



It's a big ask, I know, but can anybody out there suggest a way that this might be achieved?



(We're using Matrix 4.8.1.)



Many thanks for any help, folks.



Steve Scamp

This should be easy.


What you can do is create a normal text field in your form, then use the keyword to print the field. Then, look at the HTML code, copy it, then replace the keyword with the code. Next, change the type to hidden instead of text.



Now, all you will need to do is include a query string with your unsubscribe link. It could be easy like www.mysite.com/survey?type=survey1



Then, use some javascript in the form bodycopy, and make a var using the keyword %globals_get_type%. Then check that var to see if you have a string match, if you do, then insert your text into the hidden field.



Let me know if you have any questions…

[quote]
This should be easy.



What you can do is create a normal text field in your form, then use the keyword to print the field. Then, look at the HTML code, copy it, then replace the keyword with the code. Next, change the type to hidden instead of text.



Now, all you will need to do is include a query string with your unsubscribe link. It could be easy like www.mysite.com/survey?type=survey1



Then, use some javascript in the form bodycopy, and make a var using the keyword %globals_get_type%. Then check that var to see if you have a string match, if you do, then insert your text into the hidden field.



Let me know if you have any questions…

[/quote]



Hi Nic,



Many thanks for this. Even better, I actually understand the process you've outlined here! This gives me hope that I might be able to follow it successfully.



Anyway, if I have trouble (e.g. with the javascript) I may have to ask you for a little help, if that's okay?



Thanks again for the assistance.



Steve

[quote]
Anyway, if I have trouble (e.g. with the javascript) I may have to ask you for a little help, if that's okay?

[/quote]



Absolutely!