Deprecated

This function has been deprecated.

ap_form_validation_error_response( object $validate )

Description #

Send ajax response if there is error in validation class.

Parameters #

  • $validate
    object (Required) Validation class.

Changelog #

VersionDescription
4.1.0This function has been deprecated.
3.0.0Introduced.

Source #

File: includes/deprecated.php

function ap_form_validation_error_response( $validate ) {
	_deprecated_function( __FUNCTION__, '4.1.0' );

	// If error in form then return.
	if ( $validate->have_error() ) {
		ap_ajax_json(
			array(
				'success'  => false,
				'form'     => $_POST['ap_form_action'],
				'snackbar' => [
					'message' => __( 'Check missing fields and then re-submit.', 'anspress-question-answer' ),
				],
				'errors'   => $validate->get_errors(),
			)
		);
	}
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment