Title: [Plugin: Contact Form 7] textarea input is wrongly functioning as text input
Last modified: August 19, 2016

---

# [Plugin: Contact Form 7] textarea input is wrongly functioning as text input

 *  Resolved [theresacambria](https://wordpress.org/support/users/theresacambria/)
 * (@theresacambria)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-textarea-input-is-wrongly-functioning-as-text-input/)
 * I applied the following code to the textarea.php file and the onfocus/onblur 
   functionality works but now the field only allows one line of text in the middle
   of the box, instead of multiple lines starting at the top of the box, as if it
   were a text input instead of textarea input.
 * Here is the code I used plus a little of what comes just before it and just after
   for reference:
 *     ```
       if ( ! empty( $content ) )
       			$value = $content;
       	}
   
       // Default value disappears onfocus, reappears onblur if still empty
       $html = '<input type="textarea" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . 'onfocus="if(this.value==\'';
       $html = $html . esc_attr( $value ) . '\') this.value=\'\';" onblur="if(this.value==\'\') this.value=\'' . esc_attr( $value ) . '\';" </textarea>';
   
       	$validation_error = '';
       	if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
       ```
   
 * Any help would be much appreciated!
 * [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-textarea-input-is-wrongly-functioning-as-text-input/#post-1622940)
 * `<input type="textarea"` ?
 * It should be `<textarea`
 *  Thread Starter [theresacambria](https://wordpress.org/support/users/theresacambria/)
 * (@theresacambria)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-textarea-input-is-wrongly-functioning-as-text-input/#post-1623076)
 * **Thank you** so much! That fixed the problem 🙂 Great plugin, by the way.
 * For anyone reading this in the future – the code I posted before, together with
   the correction, worked perfectly in Firefox 3.6.8 but in IE7 and IE8 the default
   value was acting a bit wacky. On page load it was showing all the source code
   that follows the contact form as the default value but if I deleted it and clicked
   out of the box the correct value would show up in its place. I replaced the previous
   custom code with this (provided by vmercader):
 * `$html = '<textarea name="' . $name . '"' . $atts . ' onblur="if (this.value 
   == \'\') {this.value = \'' . esc_html( $value ) . '\';}" onfocus="if (this.value
   == \'' . esc_html( $value ) . '\') {this.value = \'\';}">' . esc_html( $value).'
   </textarea>';`
 * Now the textarea functions perfectly across the board.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Contact Form 7] textarea input is wrongly functioning as text
input’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [input](https://wordpress.org/support/topic-tag/input/)
 * [onblur](https://wordpress.org/support/topic-tag/onblur/)
 * [onfocus](https://wordpress.org/support/topic-tag/onfocus/)
 * [text](https://wordpress.org/support/topic-tag/text/)
 * [textarea](https://wordpress.org/support/topic-tag/textarea/)
 * [value](https://wordpress.org/support/topic-tag/value/)

 * 2 replies
 * 2 participants
 * Last reply from: [theresacambria](https://wordpress.org/support/users/theresacambria/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-textarea-input-is-wrongly-functioning-as-text-input/#post-1623076)
 * Status: resolved