Help with custom search form with four multi-choice checkbox fields

By: Peter Schwenk | Asked: 07/03/2024
ForumsCategory: Code HelpHelp with custom search form with four multi-choice checkbox fields
Peter Schwenk asked 2 months ago
Hello. I'm attempting to create a custom search form that has four multi-choice checkbox fields (one each for a different criteria/field in another form).  For example, one checkbox allows for one to pick multiple school grades.  Choosing more than one would imply that the user is searching records in the target form with a grade or another grade or another.  Choosing other criteria imply an and relationship. Just to add to the complication, there's a text field in the search form for searching for a keyword.  Keywords are in a single field in the target form that people are searching in. I'm attaching a screenshot of what the search form looks like in order to hopefully clarify what I'm doing. Here's an example search: Grades chosen:
  • First grade
  • Third grade
  • Twelfth grade
Subjects chosen
  • Art
  • Music
These choices mean that the user is searching for records of grade "First Grade", "Third grade, OR "Twelfth grade" AND subjects "Art" or "Music". I've been looking at the examples on the https://formidableforms.com/knowledgebase/create-custom-search-form/ page, especially the (tiny!) "Use a Checkbox field in search form" section.  I think my success hinges on successfully using the "frm_filter_where_val" hook, but there are precious few examples of this in the docs. Anyone out there have some experience with this that they'd like to impart?  Any help would be appreciated.  Thanks!
Attachments
1 Answers
Rob LeVineRob LeVine answered 2 months ago
Before we go down the dark path of frm_filter_where_val, did you explore using the "Add new group" feature in the view's filter? Using that you can do "(x OR OR y) AND (1 OR 2 OR 3)"
Attachments
Peter Schwenk replied 2 months ago

Thanks for the suggestion. I'll look into it. I've never used (or noticed) the "add new group" feature in the filter section. I'll post any results, success or failure.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right