gpb_auto_select_single_date

  1. Description
  2. Usage
  3. Parameters
  4. Since
  5. Examples
    1. Enable for all services
    2. Enable for a specific service

Description

Enable auto-selection of single available dates.

By default, auto-selection is disabled.

Usage

window.gform.addFilter( 'gpb_auto_select_single_date', function ( autoSelectEnabled, context ) {
	return autoSelectEnabled;
} );

Parameters

  • autoSelectEnabled boolean

    Whether auto-selection is enabled. Default is false.

  • context object

    Context object containing service and field information.

  • context.service object

    The current service object.

Since

This filter is available since version 1.0-beta-1.5.

Examples

Enable for all services

Enable auto-selection for all services.

window.gform.addFilter('gpb_auto_select_single_date', function(autoSelectEnabled, context) {
	return true;
});

Enable for a specific service

Enable auto-selection for a specific service.

window.gform.addFilter('gpb_auto_select_single_date', function(autoSelectEnabled, context) {
	if (context.service?.id === 123) {
		return true;
	}
	return autoSelectEnabled;
});