WordPress.org

Forums

Contact Form 7
Clear a field before enter text (6 posts)

  1. Marc Decroux
    Member
    Posted 1 year ago #

    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!

    http://wordpress.org/extend/plugins/contact-form-7/

  2. davejampole
    Member
    Posted 1 year ago #

    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";

    to

    $form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
    			. ' class="' . esc_attr( $class ) . '"' . $enctype . ' autocomplete="off">' . "\n";
  3. Marc Decroux
    Member
    Posted 1 year ago #

    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: http://www.apbvfr.ch/inscription/

    Thanks a lot in advance!

  4. davejampole
    Member
    Posted 1 year ago #

    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.

  5. Marc Decroux
    Member
    Posted 1 year ago #

    Sorry! I'll check this soon... Thanks!

  6. Marc Decroux
    Member
    Posted 1 year ago #

    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...

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

Tags

No tags yet.