• Resolved Bastian Fießinger

    (@bastianfiessinger)


    I have a required checkbox for data privacy. If the checkbox is not checked on submission I get a message like

    Verification failed
    Privacy value is required

    on a blank WP Error Page.

    // Validate Privacy Policy acceptance
    function theme_af_validate_acceptance( $form, $args ) {
    	$acceptance = af_get_field( 'acceptance_privacy_policy' );
    	if ( $acceptance !== true ) {
    		af_add_error( 'acceptance_privacy_policy', __('You must accept the privacy policy', 'text-domain') );
    	}
    }
    add_action( 'af/form/validate', 'theme_af_validate_acceptance', 10, 2 );

    What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Checkbox validation not working’ is closed to new replies.