gplc_validation_message_TYPE
Description
Change the validation messages when selected checkboxes don’t meet validation requirements.
Usage
Field Under Minimum
The message that displays when the number selected checkboxes is below the Minimum Limit.
add_filter( 'gplc_validation_message_field_under_min', function( $message, $form, $field_id, $group ) {
return _n( 'You must select at least %s item.', 'You must select at least %s items.', $group['min'] );
}, 10, 4 );
Field Over Maximum
The message that displays when the number of selected checkboxes is above the Maximum Limit.
add_filter( 'gplc_validation_message_field_over_max', function( $message, $form, $field_id, $group ) {
return _n( 'You may only select %s item.', 'You may only select %s items.', $group['max'] );
}, 10, 4 );
Group Under Minimum
The message that displays when the number of selected checkboxes is below the Minimum Limit and the limit spans across multiple checkboxes.
add_filter( 'gplc_validation_message_group_under_min', function( $message, $form, $field_id, $group ) {
return __( 'This field is part of a group.' );
}, 10, 4 );
Group Over Maximum
The message that displays when the number of selected checkboxes is above the Maximum Limit and the limit spans across multiple checkboxes.
add_filter( 'gplc_validation_message_group_over_max', function( $message, $form, $field_id, $group ) {
return __( 'This field is part of a group.' );
}, 10, 4 );
Parameters
message array
The message to return when validation fails.
form_id int
The current form ID.
field_id int
The current field ID.
group array
The current group of Checkbox fields which are sharing a limit.
Since
This filter is available since GP Limit Checkboxes 1.2.