Validate::validate_is_checked( object $field )
Description #
Author – Jay Iyer (06/26/2019) Validate ‘is_checked’ field.
Description – Add the ‘is_checked’ validate method to require the Checkbox field to be checked on form submit.
Parameters #
- $fieldobject (Required) Instance of @see
AP_Field
object.
Source #
File: lib/class-validate.php
public static function validate_is_checked( $field ) { if ( ! empty( $field ) ) { $value = $field->value(); if ( ! $value ) { $field->add_error( 'is-checked', sprintf( // Translators: placeholder contain field label. __( 'You are required to check %s field', 'anspress-question-answer' ), $field->get( 'label' ) ) ); } } }
Expand full source code Collapse full source code View on GitHub: lib/class-validate.php:772
Add your comment