• Resolved adam.hal

    (@adamhal)


    Hi

    I had problem with watermarks, they are properly defined on the form screen but after displaying the form they are black, not grey and don’t disappear after clicking on the input field.

    The cause was that input fields do not have both, “wpcf7-use-title-as-watermark watermark” class and “title” attribute. I traced it back to plugin code and found this code in modules/text.php line 57:

    if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
    
    		$class_att .= ' wpcf7-use-title-as-watermark';
    		$title_att .= sprintf( ' %s', $value );
    		$value = '';
    
    }

    The problem was ‘that wpcf7_script_is()’ returned null despite script file was attached in the footer. wpcf7_script_is() is defined in includes/controller.php on line 253 and uses

    wp_script_is( 'contact-form-7' );

    to determine whether script was attached or not. While echoing above function from controller.php it returns 1. Echoing it from text.php returns 0.

    For the time being I deleted wpcf7_script_is() from the ‘if’ statement but is there any other, more elegant solution to this?

    Thanks!

    https://www.ads-software.com/extend/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Restore Contact Form 7 and switch theme to the default one.

    Thread Starter adam.hal

    (@adamhal)

    It worked on the default theme.
    I removed all scripts from my theme apart from wpcf ones in the footer but it didn’t worked.

    I use wp_register_script, wp_enqueue_script and add_action to include JS.

    Is there anything else I can try to fix this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Watermarks not working’ is closed to new replies.