Contact Form 7
[resolved] Resetting Watermarks After Submission (7 posts)

  1. S. Wyatt Young
    Posted 3 years ago #

    Does anyone know if it's possible to reset the watermarks after submission? I'm currently using the watermarks as a means to label each of the input fields, and it works great, except after the submission: the form is left looking creepily naked.

    Is there currently a way to do this through Additional Settings? If not, is there a small bit of code I can tweak until Mr. Miyoshi has time to add a way to do this through additional settings? Any help is truly appreciated!


  2. S. Wyatt Young
    Posted 3 years ago #

    To anyone looking to do this, I've figured out a rather simple solution. Simply add this action hook to the "Additional Settings" of your form:

    on_sent_ok: "$('.wpcf7-use-title-as-watermark').each(function(i,n){$(n).val($(n).attr('title')).addClass('watermark');});"

    That'll take care of it!

  3. erin814
    Posted 3 years ago #

    Thank you! This works great. Do you know how I would do this for my reset button also?

  4. happynuclear
    Posted 3 years ago #

    erin814, I added this functionality to a reset button by adding a reset button in the form code like:

    <input class="wpcf7-reset" type="reset" value="Clear form">

    Then in the main.js file attached to all my pages, used this:

    $('.wpcf7-reset').click(function(event) {

    Of course, I haven't tested the form yet, so hopefully it didn't wreck anything, but it might help you.

  5. S. Wyatt Young
    Posted 3 years ago #


    If happynuclear's solution didn't work for you, please let me know, and provide me with a link to the form in question. I'd be happy to take a look and let you know if I can find something that might be simpler than dabbling in JavaScript.

    Best Regards,

  6. erin814
    Posted 3 years ago #


    happynuclear's solution worked! Thanks for the help!


  7. nodynu
    Posted 2 years ago #

    Thanks for this :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic