• I am trying to make a custom validation function for a checkbox, but I am unable to set the error message. I’ve stepped through the code, and it seems that whenever the error message is set, then the invalidate function just returns. Here is the code:

    $tag = new WPCF7_Shortcode( $tag );
    $result->invalidate( $tag, $errorMessage);

    If the message is already set, then the invalidate function won’t set the new error message.

    
    	public function is_valid( $name = null ) {
    		if ( ! empty( $name ) ) {
    			return ! isset( $this->invalid_fields[$name] );
    		} else {
    			return empty( $this->invalid_fields );
    		}
    	}
    • This topic was modified 9 years, 3 months ago by alexibbb.

The topic ‘result invalidate not working properly’ is closed to new replies.