Watermarks not working
-
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!
- The topic ‘Watermarks not working’ is closed to new replies.