WordPress.org

Support

Support » Plugins and Hacks » Contact Form 7 » [Plugin: Contact Form 7] Limit number of character in textarea

[Plugin: Contact Form 7] Limit number of character in textarea

  • Hi,

    I have added the following code in my fonctions.php theme file:

    a`dd_filter( ‘wpcf7_validate_textarea’, ‘character_length_validation_filter’, 11, 2 );
    add_filter( ‘wpcf7_validate_textarea*’, ‘character_length_validation_filter’, 11, 2 );

    function character_length_validation_filter( $result, $tag ) {
    $name = $tag[‘name’];

    if ( ! $result[‘valid’] )
    return $result;

    if ( 250 < strlen( $_POST[$name] ) ) {
    $result[‘valid’] = false;
    $result[‘reason’][$name] = Too long.”;
    }

    return $result;
    }`

    Everything is working fine but when I exceed 250 character the error message that is showing on the form is just saying NULL. Can someone give me a hand on that please?

    Regards,

    Alex

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Limit number of character in textarea’ is closed to new replies.
Skip to toolbar