Viewing 4 replies - 1 through 4 (of 4 total)
  • This would be a useful option indeed.

    Thread Starter Ziggii

    (@ziggii)

    I have tried this post but can’t figure out how to let this work with contactform 7.

    emj

    (@emj)

    hmm, I had the same problem and got textboxes working like this:

    a) add this javascript to header.php

    function clearText(field)
    {
    if (field.defaultValue == field.value) field.value = ”;
    }

    (thanks https://www.bradino.com/javascript/clear-textfield-default-value-onclick/)

    b) in the contact form 7 plugin folder, edit file /modules/text.php

    c) find line 76
    $html = ‘<input type=”text” name=”‘ . $name . ‘” value=”‘ . esc_attr( $value ) . ‘”‘ . $atts . ‘ />’;

    d) between ‘input’ and ‘type’, add:
    onFocus=”clearText(this)”

    worked fine for me, bit of a hack tho

    ??

    Dont forget :

    onBlur="restoreText(this)"

    and

    function restoreText(field) {
    	if (field.value == '') field.value = field.defaultValue;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Contact Form 7] clear input labels’ is closed to new replies.