WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
character limit in textarea contact form 7 (1 post)

  1. somendrakm
    Member
    Posted 1 year ago #

    hi i found this code

    add_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 ( 400 < strlen( $_POST[$name] ) ) {
    		$result['valid'] = false;
    		$result['reason'][$name] = "Too long.";
    	}
    
    	return $result;
    }

    but there is a problem in this code its for all textarea i want this work for specific textarea [textarea* textarea-short] what should i do for that

    thankyou

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic