Latest Register Log In

+ Advanced Search

Searching with Checkboxes

Searching with Checkboxes
By
Mar 01, 2010 (Edited Mar 11, 2014)

Sometimes you want to let people search by checking boxes (for example, checking the options they want with a product). This is possible with WSN.

Open your advanced search template (Admin Panel -> Themes -> Manage Templates -> "Advanced Search") or whichever template you're constructing a search form in. For a checkbox search for a multiple checkbox (or multiple selector) field, place this in the search form HTML:
<input type="hidden" name="multicheckcondition" value="or" >
multicheck: <input type="checkbox" name="multichecksearch[]" value="one" > one <input type="checkbox" name="multichecksearch[]" value="two" > two <input type="checkbox" name="multichecksearch[]" value="three" > three


Replace 'multicheck' with the name of your field and the numbers one through three with the possible values of your field. You can extend this to any number of options.

Please note that with the "or" value on mutlicheckcondition the search will return a listing if any of the searcher's checked boxes are checked on the listing. If you want to only match in the event that all of the searcher's checked boxes are also checked on the listing, change it to an "and" search: <input type="hidden" name="multicheckcondition" value="and" >

For a checkbox search for a single checkbox field (just on or off), use this HTML:
<input type="hidden" name="singlecheckcondition" value="=" >
<input type="checkbox" name="singlechecksearch" value="singlecheck" > singlecheck


Replace 'singlecheck' with the name of your field.




Description Adding custom field searches to the advanced search page that use checkboxes to search.
Rating
Views 445 views. Averaging 0 views per day.
Similar Listings