Support » Plugin: Contact Form 7 » Clear a field before enter text

  • Hello !

    I setup a form with the label inside the fields :
    [text* name 50/ watermark=”name”]

    This works great. But some user doesn’t erase the texte before typing their name! Is it a way to automatically erase the field as soon as the click on it or goes on this field with the tab button? In javascript it’s easy : onFocus=”this.value=”””. But to to do the same with Contact7?

    Thanks a lot for your help!

    Best regards!

Viewing 5 replies - 1 through 5 (of 5 total)
  • My need was similar in that when a person started to fill out the form, the data from the previous user was still there and I needed to clear the previously entered content. If this is what you want to do, the following should work:

    Open up contact-form7/includes/classes.php and at line 152 change:

    $form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
    			. ' class="' . esc_attr( $class ) . '"' . $enctype . ' >' . "\n";


    $form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
    			. ' class="' . esc_attr( $class ) . '"' . $enctype . ' autocomplete="off">' . "\n";

    Seems to be twice the same code!

    I read that the following code should work:
    [text name watermark “name”]

    It’s ok with Google Chrome, but not with Safari or Firefox…

    And testing Safari and FF, I saw the Captcha doesn’t work either!

    Any issue for me to solve these two points?

    You can chaek my form here:

    Thanks a lot in advance!

    What I posted is NOT the same code twice. Use the horizontal scroll and you can see the difference between the original version and the new version.

    Sorry! I’ll check this soon… Thanks!

    I opened the classes.php file, but thre’s no lines containing the codes that I have to replace. Maybe it’s due to some modifications of the plugin…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Clear a field before enter text’ is closed to new replies.