Form Builder - autocomplete input does not use configured filtering
Overview
In the Form Builder (afform/admin), there is an option to filter autocomplete inputs by an existing saved search / autocomplete display, where appears to do no actual filtering
Reproduction steps
Confirmed on wpmaster (5.60-alpha1)
- Enable Form Builder extension
- Go to SearchKit
- Create a search for Events that filters by type (e.g. Fundraiser), add an Autocomplete display to it and save
- Go back to SearchKit and create another search for Participants
- Add a required "Participant Event" (this step may not be necessary)
- Add a Table display and save.
- using the form drop-down, create a new form for your results table
- Add a filter for the results table, Participant / Event field
- Configure the field to use the saved search and autocomplete display from step (3)
- Save the form and go to its display page
- start searching for events (using the sample data, just entering the letter S is sufficient)
Current behaviour
The Autocomplete field gives you to option of selecting any event on the system. Looking in the network requests, it appears that the search and display are not passed into the API4 endpoint at all.
Expected behaviour
The Autocomplete field should give you only options that match the filter specified in step 3.
Environment information
- Browser: Firefox 109 (also happens on Chrome)
- CiviCRM: 5.57.0, 5.58.1, 5.60-alpha / Master
Occurs on wpmaster.demo.civicrm.org
Comments
Example configurations:
Autocomplete (Events) search:
[
[
"SavedSearch",
"save",
{
"records": [
{
"name": "Fundraiser_events",
"label": "Fundraiser events",
"form_values": null,
"mapping_id": null,
"search_custom_id": null,
"api_entity": "Event",
"api_params": {
"version": 4,
"select": [
"id",
"title",
"event_type_id:label"
],
"orderBy": [],
"where": [
[
"event_type_id:name",
"=",
"Fundraiser"
]
],
"groupBy": [],
"join": [],
"having": []
},
"expires_date": null,
"description": null
}
],
"match": [
"name"
]
}
],
[
"SearchDisplay",
"save",
{
"records": [
{
"name": "Fundraiser_events_Autocomplete_1",
"label": "Fundraiser events Autocomplete 1",
"saved_search_id.name": "Fundraiser_events",
"type": "autocomplete",
"settings": {
"sort": [],
"columns": [
{
"type": "field",
"key": "title",
"dataType": "String"
}
]
},
"acl_bypass": false
}
],
"match": [
"name",
"saved_search_id"
]
}
]
]
Participant search and form:
[
[
"SavedSearch",
"save",
{
"records": [
{
"name": "Fundraiser_Participants",
"label": "Fundraiser Participants",
"form_values": null,
"mapping_id": null,
"search_custom_id": null,
"api_entity": "Participant",
"api_params": {
"version": 4,
"select": [
"id",
"contact_id.display_name",
"Participant_Event_event_id_01.title",
"Participant_Event_event_id_01.event_type_id:label"
],
"orderBy": [],
"where": [],
"groupBy": [],
"join": [
[
"Event AS Participant_Event_event_id_01",
"INNER",
[
"event_id",
"=",
"Participant_Event_event_id_01.id"
]
]
],
"having": []
},
"expires_date": null,
"description": null
}
],
"match": [
"name"
]
}
],
[
"SearchDisplay",
"save",
{
"records": [
{
"name": "Fundraiser_Participants_Table",
"label": "Fundraiser Participants Table",
"saved_search_id.name": "Fundraiser_Participants",
"type": "table",
"settings": {
"description": null,
"sort": [],
"limit": 50,
"pager": [],
"placeholder": 5,
"columns": [
{
"type": "field",
"key": "contact_id.display_name",
"dataType": "String",
"label": "Contact",
"sortable": true,
"link": {
"path": "",
"entity": "Contact",
"action": "view",
"join": "contact_id",
"target": "_blank"
},
"title": "View Contact"
},
{
"type": "field",
"key": "Participant_Event_event_id_01.title",
"dataType": "String",
"label": "Event",
"sortable": true,
"link": {
"path": "",
"entity": "Event",
"action": "view",
"join": "Participant_Event_event_id_01",
"target": "crm-popup"
},
"title": "View Participant Event"
},
{
"type": "field",
"key": "Participant_Event_event_id_01.event_type_id:label",
"dataType": "Integer",
"label": "Event Type",
"sortable": true
}
],
"actions": true,
"classes": [
"table",
"table-striped"
]
},
"acl_bypass": false
}
],
"match": [
"name",
"saved_search_id"
]
}
],
[
"Afform",
"save",
{
"records": [
{
"name": "afsearchFindFundraiserParticipants",
"requires": [],
"title": "Find Fundraiser Participants",
"description": "",
"is_dashlet": false,
"is_public": false,
"is_token": false,
"permission": "view event participants",
"type": "search",
"icon": "fa-list-alt",
"server_route": "civicrm/fundraiser-participants",
"entity_type": null,
"join_entity": null,
"contact_summary": null,
"summary_contact_type": null,
"redirect": null,
"create_submission": null,
"navigation": null,
"layout": "<div af-fieldset=\"\">\n <af-field name=\"event_id\" defn=\"{saved_search: 'Fundraiser_events', input_attrs: {multiple: true}, search_display: 'Fundraiser_events_Autocomplete_1'}\" />\n <crm-search-display-table search-name=\"Fundraiser_Participants\" display-name=\"Fundraiser_Participants_Table\"></crm-search-display-table>\n</div>\n"
}
]
}
]
]
Agileware ref CIVICRM-2101