Sprig - Filter entries by custom field checkbox values, separate values as well as all values I am having a question regarding Sprig.
I do want to filter my entries for values that are defined in a dropdown field (example below is simplified).
It does work to the point where I want to filter all entries for all values, on page load all single checkboxes should be checked as well as the all checkbox.
The problem is that Sprigs AJAX request sends a single request for each single filter e.g.:
dropdown_field[]: dropdown_value_1
dropdown_field[]: dropdown_value_2

but for the all filter, and e.g. one checkbox it will be:
dropdown_field[]: dropdown_value_1, dropdown_value_2 .....
dropdown_field[]: dropdown_value_2

Unchecking the all checkbox will not empty the array, what it should.
That will cause the single filters not to work if all is checked. How can I make sure that the query request will be one array for all values instead of multiple query requests?
All Filters should be activated on load, the all filter would be disabled then. If a single checkbox is checked all shouldn't be checked (array has to be empty except the single value).
{% set dropdown_field = ['dropdown_value_1', 'dropdown_value_2', 'dropdown_value_3', 'dropdown_value_4', 'dropdown_value_5'] %}

{% set entryQuery = craft.entries({
    dropdown_field: dropdown_field,
    section: 'section_1',
}) %}

&lt;div s-replace=&quot;#results&quot;&gt;
    &lt;div&gt;
        &lt;input sprig type=&quot;checkbox&quot; name=&quot;dropdown_field[]&quot; id=&quot;dropdown_value_all&quot; value=&quot;&quot; {{ dropdown_field|length &gt;= 5 ? 'checked disabled' : '' }}&gt;
        &lt;label for=&quot;dropdown_value_all&quot;&gt;
            Select All Values
        &lt;/label&gt;
    &lt;/div&gt;
    {% for value in dropdown_field %}
    &lt;div&gt;
        &lt;input sprig type=&quot;checkbox&quot; name=&quot;dropdown_field[]&quot; id=&quot;{{ value }}&quot; value=&quot;{{ value }}&quot; {{ value in dropdown_field ? 'checked' : '' }}&gt;
        &lt;label for=&quot;{{ value }}&quot;&gt;
            {{ value }}
        &lt;/label&gt;
    &lt;/div&gt;
    {% endfor %}
&lt;/div&gt;

&lt;div id=&quot;results&quot;&gt;
    &lt;ul&gt;
    {% for entry in entryQuery %}
        &lt;li&gt;{{ entry.title }}&lt;/li&gt;
    {% endfor %}
    &lt;/ul&gt;
&lt;/div&gt;

Thank you!
My suggestion would be to give the Select All Values checkbox a unique name. That way, you can easily detect whether it was selected or not. You should also break dropdown_field out into 2 variables to avoid confusion.
{% set select_all_values = select_all_values ?? false

{% set dropdown_field_options = ['dropdown_value_1', 'dropdown_value_2', 'dropdown_value_3', 'dropdown_value_4', 'dropdown_value_5'] %}
{% set params = {section: 'section_1'} %}

{% if not select_all_values %}
    {% set params = params|merge({dropdown_field: dropdown_field} %}
{% endif %}

{% set entryQuery = craft.entries(params) %}


&lt;div s-replace=&quot;#results&quot;&gt;
    &lt;div&gt;
        &lt;input sprig type=&quot;checkbox&quot; name=&quot;select_all_values&quot; id=&quot;dropdown_value_all&quot; value=&quot;1&quot; {{ select_all_values ? 'checked disabled' : '' }}&gt;
        &lt;label for=&quot;dropdown_value_all&quot;&gt;
            Select All Values
        &lt;/label&gt;
    &lt;/div&gt;
    {% for value in dropdown_field_options %}
    &lt;div&gt;
        &lt;input sprig type=&quot;checkbox&quot; name=&quot;dropdown_field[]&quot; id=&quot;{{ value }}&quot; value=&quot;{{ value }}&quot; {{ value in dropdown_field ? 'checked' : '' }}&gt;
        &lt;label for=&quot;{{ value }}&quot;&gt;
            {{ value }}
        &lt;/label&gt;
    &lt;/div&gt;
    {% endfor %}
&lt;/div&gt;