Converting old IN conditional for use in EE 2.11.2
Hi Low,
I'm just testing an update of a site from EE 2.5.5 and Low Search 2.3.1, to EE 2.11.2 and Low Search 4.4.4.
I'm getting an error on a search page because I'm using the IN operator in a conditional. I found your blog post (http://gotolow.com/blog/conditional-c...) about this.
I'm having trouble getting the new format to work though, so wondered if you can spot what I'm doing wrong please? It's no longer producing an error and the page is now loading, but the conditional doesn't seem to be working as the checkbox isn't staying checked when it should be.
Old code:
<label><input type="checkbox" name="search:cf_event_opening_times[]" value="Thursday"{if "Thursday" IN ({low_search_search:cf_event_opening_times})} checked="checked"{/if} />Thursday</label>
New code:
<label><input type="checkbox" name="search:cf_event_opening_times[]" value="Thursday"{if Thursday ~ '/(^|\|)'.low_search_search:cf_event_opening_times.'($|\|)/'} checked="checked"{/if} />Thursday</label>
Any help or advice on this would be appreciated.
Thanks,
Stephen
Replies
Low 27 Jun 2016 12:29
Try putting Thursday in quotes:
Low 27 Jun 2016 12:32
Or actually, turn it around:
Stephen 27 Jun 2016 12:45
Hi Low,
Thanks for this.
Both of those options worked! :-) I've gone with the second one though.
Thanks again,
Stephen