<p>Updating answer as question was updated</p>

<p>As I see it, you want to find any and all entries where the field <code>weken2017</code> has either the value <code>42</code> or <code>43</code>.</p>

<p>Assuming that I have understood this much correctly, <code>{% set entries = craft.entries.search(['OR', 'weken2017:42', 'weken2017:43']) %}</code></p>

CC BY-SA 3.0
2017-10-17T11:58:44.430Z
My bad, it was the end of the workday, of course I ran it through search, edited my question :-). I want to run the week_search_query through the search function :-)
Jan
CC BY-SA 3.0
2017-10-18T08:28:25.833Z
No worries, it happens to the best of us. Updated my answer now to reflect upon your updated question :)
Fuglsetrampen
CC BY-SA 3.0
2017-10-17T08:18:38.943Z
2017-10-18T08:28:05.483Z
2017-10-18T08:28:05.483Z
Fuglsetrampen
<p>I've got a question that I can't seem to get fixed all by myself... I've got a search form and each entry has got field with some checkboxes (in this case these are options). Now I'd like to search when they check multiple checkboxes but I can't seem to get that to work...
I've set up a form in which I'm fetching a parameter and just to test it with 2 checkboxes checked I've split them up in 'week1' and 'week2' like so:</p>

<pre><code>{% set week_search_query =  week1 ~ ' ' ~ week2  %}
</code></pre>

<p>I've tried the same with 'and' and '&amp;' in between the quotes but can't seem to get it to work, while with the 'week1' alone like so:</p>

<pre><code>{% set week_search_query =  week1 %}
</code></pre>

<p>it works perfectly. (if I print out the content of 'week_search_query' in this case I get </p>

<blockquote>
  <p>weken2017:41</p>
</blockquote>

<p>with weken2017 as fieldname and 41 as value). 
But what I'd like to to is search by 2 checked checkboxes at once as in the first example, so I can:</p>

<pre><code>craft.entries.search(week_search_query)
</code></pre>

<p>All help is welcome, I feel like quite a newbie ATM :-)</p>

CC BY-SA 3.0
2017-10-17T14:56:50.987Z
So, I've been able to find part of the solution, and I can find an "AND" solution like so: weken2017:'42, 43'
Now that I got that working I discovered I actually need an "OR" solution, so the search goes on and all help is still appreciated :-)
Jan
<search><checkboxes>
Searching on multiple checkboxes
# Searching on multiple checkboxes

(Asked by: username_0 on 2017-10-16)

I've got a question that I can't seem to get fixed all by myself... I've got a search form and each entry has got field with some checkboxes (in this case these are options). Now I'd like to search when they check multiple checkboxes but I can't seem to get that to work...
I've set up a form in which I'm fetching a parameter and just to test it with 2 checkboxes checked I've split them up in 'week1' and 'week2' like so:
{% set week_search_query =  week1 ~ ' ' ~ week2  %}

I've tried the same with 'and' and '&' in between the quotes but can't seem to get it to work, while with the 'week1' alone like so:
{% set week_search_query =  week1 %}

it works perfectly. (if I print out the content of 'week_search_query' in this case I get 

weken2017:41

with weken2017 as fieldname and 41 as value). 
But what I'd like to to is search by 2 checked checkboxes at once as in the first example, so I can:
craft.entries.search(week_search_query)

All help is welcome, I feel like quite a newbie ATM :-)

**Tags:** search, checkboxes
> **Comments:**
> **username_0**: So, I've been able to find part of the solution, and I can find an "AND" solution like so: weken2017:'42, 43' Now that I got that working I discovered I actually need an "OR" solution, so the search goes on and all help is still appreciated :-)  

---

## 1 answers

### Answer by username_1 on 2017-10-17. Score: 1 | Accepted answer

Updating answer as question was updated

As I see it, you want to find any and all entries where the field `weken2017` has either the value `42` or `43`.

Assuming that I have understood this much correctly, `{% set entries = craft.entries.search(['OR', 'weken2017:42', 'weken2017:43']) %}`

> **Comments:**
> **username_0**: My bad, it was the end of the workday, of course I ran it through search, edited my question :-). I want to run the week_search_query through the search function :-)  
> **username_1**: No worries, it happens to the best of us. Updated my answer now to reflect upon your updated question :)  

---

