Until V3, you can have a field only in the one type on the page. In V3 (due in a few months), you will be allowed to have the fields multiple times, to allow showing of different format fields responsively.
You would need to create your own CSS for the form, using CSS media queries to make the CSS responsive. For example, you can wrap your CSS for the desktop display (horizontal) so it does not affect the mobile view, but you need to discover the responsive breakpoint of your theme. For example, like this:
@media (min-width: 992px) {
.searchandfilter[data-sf-form-id="1234"] {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
}
Where 1234 needs to be changed to match your form ID.
For more custom CSS examples, there are many snippets in the forum:
https://support.searchandfilter.com/forums/search/data+form+sf+id+searchandfilter
That is indeed what I was going to suggest you do next. In fact, form #2 could have Auto Submit OFF, and not submit button, and you simply place an Advanced button on the page, with javascript to copy the values over to the hidden fields, and then submit that form, using something like (assuming form #2 has an ID of 1234):
$('.searchandfilter[data-sf-form-id="1234"]').submit();
So, looking at Product Category, this CSS hides the children:
.searchandfilter[data-sf-form-id="6507"] li.sf-field-taxonomy-product_cat option.sf-level-1 {
display: none;
}
To remove the red lined items, you need this custom CSS:
.searchandfilter[data-sf-form-id="4548"] .sf-field-taxonomy-product_category .sf-level-0 > .sf-input-checkbox,
.searchandfilter[data-sf-form-id="4548"] .sf-field-taxonomy-product_category .sf-level-0 > .sf-label-checkbox {
display: none;
}
.searchandfilter[data-sf-form-id="4548"] ul li.sf-field-taxonomy-product_category > ul > li {
padding: 0;
}
As to the remove empty fields, I have no solution for that sorry. It may be something we will add in V3 (not due for some months yet), I am not sure.
It might be possible to do this with custom JavaScript, that checks if the field is empty, but I do not know how that would be done and have no snippets to share.
Your custom CSS:
.searchandfilter[data-sf-form-id="2167"] .sf-field-submit input {
border-radius: 3px;
color: #fff;
font-family: Assistant;
font-weight: 400;
}
You need to have the icons in the size you need as transparent png images of the correct size on your site. The CSS would be something like this I think:
.searchandfilter[data-sf-form-id="2167"] .sf-field-search input {
padding-right: 30px;
background: url(your path to the image);
}
and
.searchandfilter[data-sf-form-id="2167"] .sf-field-taxonomy-job_locations select {
padding-right: 30px;
background: url();
}
I think.
Something like this:
.searchandfilter[data-sf-form-id="8746"] li.sf-field-post-meta-german_players label:after {
content: "";
display: inline-block;
width: 15px;
height: 10px;
background: url(https://kasinoforum.com/images/de.png);
margin-left: 6px;
background-size: contain;
}
Is that what you mean?
The link you gave me comes back as IP address not found?
Did you use a copy of the form, or a different form, for the mobile view (as that is not allowed and will not work)?
You can wrap your CSS for the desktop display (horizontal) so it does not affect the mobile view, but you need to discover the responsive breakpoint of your theme. For example, like this:
@media (min-width: 992px) {
.searchandfilter[data-sf-form-id="1234"] {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
}
Where 1234 needs to be changed to match your form ID.
Having a cloned form will potentially be an issue, as doing this (having more than one instance of the same form, or multiple different forms) will mean that they don’t work together and often will conflict with each other. Just be aware that this is possible (likely), so if you have problems with the results not working, that might be why. Normally, we suggest only one form instance on the results page.
You CAN have more than one form on any page other than the results page.
We are making some changes around this for V3, due in a few months.
This:
@media (min-width: 992px) {
.searchandfilter[data-sf-form-id="224"] {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
}
Is code aimed at a desktop, it would look like this for mobile:
@media (max-width: 991px) {
.searchandfilter[data-sf-form-id="224"] {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
}
Something like this:
.searchandfilter[data-sf-form-id="485"] .sf-field-submit input {
color: #fff;
border: 0;
border-radius: 4px;
font-size: 18px;
font-family: 'Nunito',Helvetica,Arial,Lucida,sans-serif;
font-weight: 700;
background-color: #ff2e73;
padding: 10px 30px;
}
AnonymousInactive
Hi,
Please check the following URL-
https://mool-hatabo.co.il/
I created a search bar to display only on PC & Tablets and added the following css:
.searchandfilter[data-sf-form-id="160"] > ul > li {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
.searchandfilter[data-sf-form-id="160"] > ul {
display: table;
margin: 0 auto 10px;
}
.searchandfilter[data-sf-form-id="160"] > ul > li {
padding: 0 12px 0 0;
}
Then, I duplicated it and created a new form to display only on mobile and added the following CSS-
@media (min-width: 992px) {
.searchandfilter[data-sf-form-id="224"] {
display: inline-block;
vertical-align: top;
padding: 0 20px;
}
}
I got 2 questions-
A) How can I center the 2nd form (mobile) using css? (including the submit button)
B) Is there a better way to do this or just duplicating the forms is okay?
Thanks in advance.