I want to set a field value with get request
example.com/subscribe/?email=asfafs
but when i load the page which has the form on it, the form does not show. I get why it could not be showing. Because the form itself could submit a get request as well. I also installed this plugin which should enable me to set a field value, but it does not.
this is what i have:
<p>Uw naam (verplicht)<br />
[text* input-name] </p>
<p>Uw email (verplicht)<br />
[dynamictext dynamicname "CF7_GET key='email'"] </p>
<p>Onderwerp<br />
[text your-subject] </p>
<p>Uw bericht<br />
[textarea your-message] </p>
<p>[submit "Verzenden"]</p>
In my page:
<?php echo do_shortcode('[contact-form-7 id="1062" title="Contactformulier 1"]'); ?>
I wouldn't mind using a different plugin for this. If there is one which suits my needs please tell me.
Text field# Both text and text* are used for single-line input and accept any form of text. The difference between them is that text* connotes a required field. In Contact Form 7's convention, all types of tags with an asterisk '*' mean that these are required fields.
It is, however, possible to get the default values from the context within which the form is placed. To do this, add default:{source} option to the form-tag from which you want to derive the default value. Available data sources are: get (HTTP GET variables), post (HTTP POST variables), and post_meta (custom fields).
The simplest way of getting default values to your form is getting them from the post meta. There are no conditions to this and you simply set a default value for a form field. To do this, use the default keyword and set the desired default value.
I just installed the plugin you linked and tested it. The plugin isn't meant to pull in a GET variable for a field within Contact Form 7. The plugin will do two things
The shortcode that you have in your example is for use by this http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/ plugin. I downloaded and tested that plugin as well, and it seems to work just fine.
Here is the page I created the example on. http://jtwebb.com/stackoverflow-question/?someemail=asdf if you want to take a look to see it is working with the dynamic-text-extension plugin.
UPDATE: This is my contact form 7 code:
<p>Your Name (required)<br />
[text* your-name] </p>
<p>[showparam someemail] <-- this is the shortcode of show param, just text no field</p>
<p>[getparam someemail] If you inspect this you'll see a hidden get field with the value of 'someemail' in it.</p>
<p>Your Email (required)<br />
[dynamictext* dynamictext-380 "CF7_GET key='someemail'"]<br>This field was created with <a href="http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/">http://wordpress.org/plugins/contact-form-7-dynamic-text-extension/</a></p>
<p>Subject<br />
[text your-subject] </p>
<p>Your Message<br />
[textarea your-message] </p>
<p>[submit "Send"]</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With