Skip Navigation

[Resolved] Split: set default select option for custom search filter

This support ticket is created 5 years, 2 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by FelipeP5703 5 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1221767

Ok that works, but if I want to show only inputs that are available, why doesn't it work? Those inputs in massage were there, they were just not showing.

While we are on the subject, on the custom search, is there anyway to choose a default selection? For example, I have "Estado" (States) as a dropdown menu and I want the search to automatically have "Rio de Janeiro" as selected because I do not have any client from "São Paulo." I do not see an option to set an option as default.

#1221770

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - I've added the following code to your view's "search and pagination" section JS box:

jQuery(document).ready(function($){
  $("select[name='wpv-wpcf-estado'] option[value='1']").attr('selected','selected');
});
#1221791

I appreciate the code but that's not what I expected. I thought Toolset had this option in its code.
The issue is that I will have to create another one for city as well because it has conditional output and I did not want that.

Also I tested and although it does choose the correct state, there is conditional output when selecting Rio de Janeiro as a state, then it should display the city, if Rio de Janeiro (the city) is chosen, then it would display the neighborhood. And with that JQ code, it's doesn't work as expected.

I guess I will have to leave it alone and let the user choose.

#1221795

I deleted your JQ code, and now the condition output for city is not showing when selecting Rio de Janeiro. It only works after refreshing the page, this should not happen.

#1222500

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I appreciate the code but that's not what I expected. I thought Toolset had this option in its code.
=> No - there is no such feature available. But feel free to demand this feature by submitting the feature request using the following form:
- https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

This ticket is originally created to guide you about how you can add default selection to your select filter. Please open a new ticket with your every question you may have. This will help other users searching on the forum as well as help us to write correct ticket resolution summary.

#1222516

My issue is resolved now. Thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.