Skip Navigation

[Resuelto] multiple checkbox in search form

This support ticket is created hace 2 años, 11 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 4 respuestas, has 2 mensajes.

Last updated by juanC-8 hace 2 años, 11 meses.

Assigned support staff: Beda.

Autor
Mensajes
#1269453

Hi!

I have a search form with multiple checkbox and I want to group them in a frame with a scroll to avoid show all.

It's possible to do what I want or something similar?

Thank you

#1269743

It'd require custom HTML and CSS, something we cannot assist in the Support Forum, as the design is done by the webmaster, while the structure with Toolset - for which we can provide full assistance.

To alter the checkboxes (or any other input kind of Toolset Views Search) you need to apply CSS to the basic HTML elements produced by the Toolset ShortCodes (the select inputs, checkboxes etc are all built with basic HTML).
First, you'll need to ensure the Toolset ShortCodes load "raw", means they load no other style but what minimally necessary (HTML and browser basics).
This is done in the GUI when inserting Filters, you can choose to output them with or without styles added. Choose without, hence, raw.

After that, your View on the Front End will still show the inputs (checkboxes, or any other) but with basic browser display, no Bootstrap or else applied.
Hence you can now add your own HTML around it, and apply CSS to it as well as to the input itself.
I'd probably wrap the entire Search input shortcode in a DIV and give it a fixed size so that inside of it I can apply the scroll you mention and group the checkboxes in a square (same amount on several lines) inside it.

When you insert Toolset ShortCodes for the search you can also pass a "class" attribute, which helps you add your own custom CSS classes to its output, and you can pass "style" which accepts valid CSS as input for inline style.

If you need someone to make the exact layout of the search you mention I'd suggest contacting a contractor from https://toolset.com/contractors/ as Toolset Support couldn't provide full stack HTML and CSS layouts for this, but we can show how to get there step by step within Toolset, and show the things that Toolset will help you within this case.

Natively in Toolset the checkboxes options when inserting the searches is all that's available, custom styling should be applied through custom CSS applied to the generated HTML and wrapping HTML as above suggested, see an example here for the basic HTML and CSS: https://stackoverflow.com/questions/12021338/scrollable-area-with-checkboxes
Note that a Toolset ShortCode will produce the label and inputs for each item without you need to add the HTML for it, that is what our Search ShortCode is there for.
So you will only work with the HTML around it, and apply CSS to both the generated and your custom HTML.
To find classes and ID of generated items you can always use the Google Chrome Console Inspector tool, which is the best resource to find quickly the ID or class of an element to address later with CSS or even JS.

In the loop things are different.
Here we not only offer a Loop Wizard to add basic loop layouts, but we also offer integration with several builders that help to visually organize the Loop's content. However such builders cannot be used in the Search part.
Note that the new Views Beta available at https://toolset.com/account/downloads/, contains a new approach to create Views which starts in the post editor, maybe you want to give it a try to later suggest improvements to the filter section?
I'd suggest doing that on staging sites only, of course.

Thank you for understanding the Support limitations.

#1270835
field.png
two_choose.png
one_choose.png

I think I have something that I can use.

In the first photo if I choose only the option for "subvoz" named "Otros" it returns results. But in the second photo, if I choose two options "Otros" and "Ordinario" it returns nothing.

How can I do to show options of "Otros" and "Ordinario".

I have put the filter like a multi-select and the field is a select. If I set the field "Subvoz" as checkbox and then put filter as multi-select will do what I want?

Thank you

#1271611

You mean to search for posts with values as selected in the MultiSelect input, but in a "OR" combination in each option selected of that single input?
You could select the filed to operate between values - that would sort of allow to filter by an "OR" similar behaviour.

Otherwise, you can only control the operator between many fields in the Query Filter options (Relationship to use when querying with multiple fields:), and that won't help for values in the same field.
You can however not filter a View by a single field and use the fields options as an OR value to query by.

This is because such a query wants to find the precise value in a field, not inbetween field values.
To have a filter that allows an OR query like that you'd have to add a second field and basically store each OR value there.

You would have 2 Select Fields, for example, each with some values, and then you can select posts with either of the fields matching the query value in a view. Not with a single field, though.

If you need more assistance with this, could you open a new ticket so we can keep the threads on the topic?

Thank you!

#1272861

I'll find another solution thank you