Calendar picker field uses Google Calendar free/busy API for booking. PRO feature.
Server-side Calendar requests use the same site capability envelope as Google Sheets: license_key, product, forge_site_url, and site_token. Direct calls that only know the license key are rejected before the Worker touches Google tokens or creates events. Public submissions also validate calendar_picker values before payment capture: the posted value must parse to a future timestamp inside the field’s configured advance window, on an enabled weekday, and within work_start <= slot < work_end.
Calendar Picker Field
json
{
"id": "field_appointment",
"type": "calendar_picker",
"label": "Preferred Time",
"required": true,
"slot_duration": 30,
"work_start": 9,
"work_end": 17,
"advance_days": 30
}Slot Calculation Flow
- User selects a date
- Frontend sends AJAX request to
formforge_calendar_slots - Server queries Google Calendar free/busy API
- Busy periods are subtracted from working hours to produce available slots
- Fallback: if Google API is unavailable, all slots within working hours are shown
php
$result = FORMFORGE_Forge_API::instance()->calendar_freebusy(
$calendar_id,
'2025-02-15T00:00:00Z',
'2025-02-15T23:59:59Z',
30, 9, 17
);
// Returns: { "available_slots": ["09:00", "09:30", "10:00", ...] }—