Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I am getting the error
"An illegal choice has been detected. Please contact the site administrator."
When using the combined sort option for date fields but only on the first load.
This is the error in the syslog
|http://hfl.local.com/events?keywords=&q=events&sort_bef_combine=field_ev...|http://hfl.local.com/events|1||Illegal choice field_event_from_date ASC in Sort by element.
But then I load the url again and the error disappears.
I have tried unticking 'Combine sort order with sort by' and then the date sort works fine again.
View config pasted below.
langcode: en
status: true
dependencies:
config:
- search_api.index.content_index
module:
- better_exposed_filters
- search_api
id: event_listing
label: 'Event Listing'
module: views
description: ''
tag: ''
base_table: search_api_index_content_index
base_field: search_api_id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: none
options: { }
cache:
type: tag
options: { }
query:
type: views_query
options:
bypass_access: false
skip_access: false
exposed_form:
type: bef
options:
submit_button: Search
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
input_required: false
text_input_required: 'Select any filter and click on Apply to see results'
bef:
general:
allow_secondary: false
secondary_label: 'Advanced options'
autosubmit: false
autosubmit_hide: false
sort:
bef_format: default
advanced:
collapsible: false
collapsible_label: 'Sort options'
combine: true
combine_rewrite: "Relevance Desc|Relevance\nRelevance Asc|\nEvent start date Asc|Event date (asc)\nEvent start date Desc|Event date (desc)"
reset: false
reset_label: ''
is_secondary: false
search_api_fulltext:
bef_format: default
more_options:
is_secondary: false
rewrite:
filter_rewrite_values: ''
text_input_required_format: full_html
pager:
type: full
options:
items_per_page: 5
offset: 0
id: 0
total_pages: null
tags:
previous: ‹‹
next: ››
first: '« First'
last: 'Last »'
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
quantity: 9
style:
type: default
row:
type: search_api
options:
view_modes:
'entity:node':
blog: default
events: teaser
landing_page: default
landing_page_2: default
news: default
page: default
fields:
rendered_item:
table: search_api_index_content_index
field: rendered_item
id: rendered_item
entity_type: null
entity_field: null
plugin_id: search_api
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
link_to_item: false
multi_type: separator
multi_separator: ', '
filters:
type:
id: type
table: search_api_index_content_index
field: type
relationship: none
group_type: group
admin_label: ''
operator: or
value:
events: events
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
plugin_id: search_api_options
field_hide_from_search:
id: field_hide_from_search
table: search_api_index_content_index
field: field_hide_from_search
relationship: none
group_type: group
admin_label: ''
operator: '!='
value: true
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_boolean
status:
id: status
table: search_api_index_content_index
field: status
relationship: none
group_type: group
admin_label: ''
operator: '='
value: true
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_boolean
search_api_fulltext:
id: search_api_fulltext
table: search_api_index_content_index
field: search_api_fulltext
relationship: none
group_type: group
admin_label: ''
operator: or
value: ''
group: 1
exposed: true
expose:
operator_id: search_api_fulltext_op
label: Search
description: ''
use_operator: false
operator: search_api_fulltext_op
identifier: keywords
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
hfl_admin: '0'
user_admin: '0'
editor: '0'
content_area_managers: '0'
ecommerce_manager: '0'
bloggers: '0'
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
parse_mode: terms
min_length: null
fields:
rendered_item: rendered_item
title: title
plugin_id: search_api_fulltext
field_event_to_date:
id: field_event_to_date
table: search_api_index_content_index
field: field_event_to_date
relationship: none
group_type: group
admin_label: ''
operator: '>='
value:
min: ''
max: ''
value: now
type: offset
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_date
sorts:
search_api_relevance:
id: search_api_relevance
table: search_api_index_content_index
field: search_api_relevance
relationship: none
group_type: group
admin_label: ''
order: DESC
exposed: true
expose:
label: Relevance
plugin_id: search_api
field_event_from_date:
id: field_event_from_date
table: search_api_index_content_index
field: field_event_from_date
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: true
expose:
label: 'Event start date'
plugin_id: search_api
field_event_from_date_1:
id: field_event_from_date_1
table: search_api_index_content_index
field: field_event_from_date
relationship: none
group_type: group
admin_label: ''
order: ASC
exposed: false
expose:
label: ''
plugin_id: search_api
title: Events
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- 'url.query_args:sort_by'
- 'url.query_args:sort_order'
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders:
metatag_display_extender: { }
path: events
exposed_block: true
cache:
type: none
defaults:
cache: false
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- 'url.query_args:sort_by'
- 'url.query_args:sort_order'
tags: { }
Comments
Comment #2
farse CreditAttribution: farse at Zoocha commentedI found a solution to my issue. I had another search box in the menu with different sort options (but hidden) and this form was validating with the form state of my exposed sorts on my other page and causing this error. The solution I have used is doing a form alter and unsetting the sort options when not on the search page.
Comment #3
ajitshinde39 CreditAttribution: ajitshinde39 commentedHi, i am also getting this error,
Comment #4
scott_euser CreditAttribution: scott_euser at Soapbox Communications Ltd commentedNot sure if it is the same issue, but combining sorters using GET requests does cause this exact error. https://www.drupal.org/project/better_exposed_filters/issues/3047454
Comment #5
Neslee Canil PintoWe are trying to deprecate 8.x-3.x, can you please check whether this still exists in 8.x-4.x/8.x-5.x branch.