Support » Plugin: Contact Form 7 » [Plugin: Contact Form 7] Can it do this?

  • Resolved dclardy


    I am converting a site from php to wordpress. The site has a contact form in the sidebar that post the information to a larger version of the contact form. The user then fills out the information and submits the second form.

    Can contact form 7 be used to do this? If not, any suggestions?

Viewing 15 replies - 1 through 15 (of 15 total)
  • I just wanted to add some more information about what I am trying to do.

    The user inputs First Name, Last Name, and Phone Number in the smaller version of the form. When they press submit, they are taken to the contact page with the information already submitted filled in on the larger version of the same form. They can then answer some more questions. They press submit on the large version of the form, and it sends the email.

    Any ideas here?

    Well, I think you’d want to use a regular form (not a Contact Form 7 Form) for the first form (otherwise you’ll end up sending two emails). You could submit this form to a page with a Contact Form 7 Form on it, and collect the GET variables into the larger form using the Contact Form 7 Dynamic Text Extension:

    What would use to create the first form? Could the larger form be used by itself? If the values are empty, how does it function?

    You’d create the first form with normal HTML form syntax. Just point it at the URL of the Contact Form 7 page. Something basic like:

    <form name="smallform" action="the_cf7_big_form_page_url" method="GET">
    First Name: <input type="text" name="name" />
    <input type="submit" value="Submit" />

    Yes, you could use the larger form by itself. When the values are empty, the dynamic field functions as a normal text field. In other words, the default is set to an empty string rather than a dynamic value.

    Alright. I have created the form, and I am trying to get it to work properly. I am posting the data to the address bar, but it is not being placed into the form correctly.

    Here is what I am seeing:

    Here are the values for the fields.

    <p>First Name (required)
        [dynamictext* first-name "CF7_GET val='first-name'"] </p>
    <p>Last Name (required)
        [dynamictext* last-name "last-name"] </p>
    <p>Daytime Phone Number (required)
        [dynamictext* day-phone "day-phone"] </p>
    <p>Email (required)
        [dynamictext* their-email "their-email'] </p>

    First off, they should all be in the same structure as the first-name field, i.e.:

    [dynamictext* last-name "CF7_GET val='last-name'"]
    [dynamictext* day-phone "CF7_GET val='day-phone'"]
    [dynamictext* their-email "CF7_GET val='their-email'"]

    Given that you’re seeing the shortcode rather than the input box, are you sure you (a) installed and (b) activated the Dynamic Text plugin?

    It is installed and activated. I was changing them around to trying to get it to work. I do need to change those other ones back.

    Does this not work with the latest wordpress?

    Definitely works on the latest WP. Looks like it may be a dependency issue, I’ll look into it and get back to you.

    Greetings dclary,

    I have released a new version of the Dynamic Text Extension – version 1.0.1. Please download and install this update. This should fix the dependency issue that you were having (basically, this was being loaded before the Contact Form 7 Plugin, and the dependency was broken).

    Also, please replace “val=” with “key=” in your dynamictext shortcodes. It should look like:

    <p>First Name (required)
        [dynamictext* first-name "CF7_GET key='first-name'"] </p>
    <p>Last Name (required)
        [dynamictext* last-name "CF7_GET key='last-name'"] </p>
    <p>Daytime Phone Number (required)
        [dynamictext* day-phone "CF7_GET key='day-phone'"] </p>
    <p>Email (required)
        [dynamictext* their-email "CF7_GET key='their-email'"] </p>

    I set up a temporary test page so you can see how it’s working on my site: (email left blank to show how it works without a value.

    Hope that works for you!


    It works great. Thanks a ton for the help. Great plugin by the way.

    You’re welcome! Glad to hear it worked out 🙂 And thanks!

    Here is another question on this:

    Everything is working fine, but there is an issue with IE. I am sure that this is not plugin related, but I was hoping that you could help.

    In chrome and firefox, the small form post this information to the address bar:

    In IE, it does this:

    Is there anyway to get the @ to show up in IE.

    I haven’t heard of this Internet Explorer glitch in the past, but I’m not terribly surprised to hear it exists. I’m not sure what version of IE you’re using (perhaps this has been fixed in a newer version), but regardless, you want this to work for everyone anyway. I searched around a bit for solutions, but didn’t actually find this bug documented anywhere.

    You could use a JavaScript solution, but that’s a bit complicated and not good for accessibility.

    You understand that the reason this is an issue at all is because non-valid URL characters (like spaces, the @ sign, etc), need to be encoded in the URL (that’s what the %40 is). It seems that while Firefox and Chrome successfully encode the character, IE just drops it (in your case at the least).

    So, instead of using GET, a simple solution would be to use POST. With POST, the variables are not encoded in the URL, and we sidestep the problem entirely. Just do the following:

    1. Change your small form’s method attribute to "POST"
    2. Add a shortcode to handle grabbing POST variables. It’d look something like this:

    function my_get_post_value_fcn($atts){
    		'key' => -1,
    	), $atts));
    	if($key == -1) return '';
    	$val = $_POST[$key];
    	return $val;
    add_shortcode('get-POST-value', 'my_get_post_value_fcn');

    3. Change your dynamic text values in the Contact Form to something like:

    [dynamictext* email "get-POST-value key='email'"]

    (You’ll use the new POST function for all of them.)

    Note that I haven’t tested these functions. I’ll also add a POST shortcode like the one I described to my list of updates for the next plugin release.

    Hope that helps!

    That works just fine. Here is what I ended up using. It follows your previous convention of naming. You could probably just paste it in.

    function cf7_post($atts){
    		'key' => -1,
    	), $atts));
    	if($key == -1) return '';
    	$val = $_POST[$key];
    	return $val;
    add_shortcode('CF7_POST', 'cf7_post');
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: Contact Form 7] Can it do this?’ is closed to new replies.