[resolved] [Plugin: Contact Form 7] Success page hide forms (5 posts)

  1. xmpi
    Posted 6 years ago #

    Here comes a temporary solution on hiding input fields of Contact Form 7 plugin after input data is sent.
    You may see some replies on this subject on http://wordpress.org/support/topic/244959, but the hacks mentioned are not working for version 2.2.1 of this plugin.

    So, if you want to hide all input fields including submit button after data sent success:
    1) Go to "includes" folder of plugin and edit the "classes.php" file.
    Add the following line right after $class .= ' wpcf7-mail-sent-ok';
    echo "<style type=\"text/css\">.showhide {display: none;}</style>";

    2) In the admin panel of contact form 7 plugin, add the following line in the beginning of the forms description: <div class="showhide">
    Then close this tag in the end of the forms description: </div>.
    Just for example:

    <div class="showhide">
    <p>Your name
    [text* your-name] </p>
    <p>[submit "Submit"]</p>

  2. Nabha
    Posted 6 years ago #

    Thanks, I was looking for exactly this solution. Would love to be able to do it without a hack!

  3. chembro303
    Posted 5 years ago #

    Hi, I tried your hack with no success, but actually figured out a way to do it without any hacks.

    Do the same thing you did in your step #2 - add a div wrapping the entire contact form in the admin panel. I used

    <div id="hideform">
    ... contact form fields here ...

    Then at the bottom of the admin page under "Additional Settings" put the following:

    on_sent_ok: "document.getElementById('hideform').style.display = 'none';"

    Obviously if you named your div with a different ID other than "hideform" then put the ID you chose. That should be it!

  4. calutateo
    Posted 5 years ago #

    Thanks a lot, chembro303! It works like a charm!

    I would like to hide the form after submission for the logged in user forever. So he can only submit the form once.
    Any idea?

  5. Ashton.Sanders
    Posted 5 years ago #

    Great work chembro303. Thanks. It works, and it isn't a hack!

    @calutateo: That's most likely not something you can do with this contact form. I would imagine you'd have to save that info to the user's account somehow.

Topic Closed

This topic has been closed to new replies.

About this Topic