Reputation: 293
I'm trying to GET URL parameters and to add it as hidden values into Contact Form 7. The goal is to retrieve them trough a webhook to Zapier.
I'm trying like this (under the Form tab, at the bottom of my form, just before submit action):
[hidden channel default:get]
[hidden campaign default:get]
[hidden campaignid default:get]
[hidden cta default:get]
[hidden language default:get]
[hidden iso default:get]
and then it shows up correctly into Zapier plugin tab like this
"channel": "??????",
"campaign": "??????",
"campaignid": "??????",
"cta": "??????",
"language": "??????",
"iso": "??????"
but after running a test and retrieve the data in Zapier, the field appears without any value in it.
For your information, I've also tried the plugin Contact Form 7 Get and Show Parameter from URL and it wasn't working iether.
Also, my webhook is perfectly working with my other fields (hidden or form fields). So I know there is no problem from there.
Upvotes: 4
Views: 7611
Reputation: 536
A quick fix to avoid add a new pluggin just for this minor feature You can add this code in the contact form
[hidden URL id:urlField]
<script> //MAYBE ADD THIS BELOW THE SUBMIT BUTTON TO KEEP THE ORDER
if(jQuery("#urlField")) { // JUST TO PREVENT JS ERRORS BUT SHOULD ALLWAYS BE DIFFERENT TO NULL
jQuery("#urlField").val(window.location.href);
}
</script>
Upvotes: 2