Hi,
If you've added the custom field "Additional search options?" only to control the display of additional search fields in the search, you don't need that field and it can be removed from the field group "Field Group for Programs".
To add a container for the additional fields with the show/hide links, you can follow these steps.
1. In the archive where you'd like to show the link to show/hide the additional fields container, you can add a "Custom HTML" block and include the HTML code for the links to show and hide the additional fields container:
<a href="#" id="additional-fields-container-link-show">Show Additional fields</a>
<a href="#" id="additional-fields-container-link-hide">Hide Additional fields</a>
2. Next, add a container block and include the search field blocks for all the additional fields in this block. In the ID settings of this block add a special ID "additional-fields-container".
( screenshot: hidden link )
3. In the archive's custom CSS, include the following CSS code, to hide the show/hide additional field links, when the page initially loads:
#additional-fields-container-link-show,
#additional-fields-container-link-hide {
display:none;
}
4. In the archive's custom JS, include the following script, to control the display of the links and container that holds the additional fields:
jQuery( document ).ready(function() {
jQuery('#additional-fields-container-link-show').show();
jQuery('#additional-fields-container').hide();
jQuery('#additional-fields-container-link-show').click(function(){
event.preventDefault();
jQuery('#additional-fields-container').show();
jQuery('#additional-fields-container-link-show').hide();
jQuery('#additional-fields-container-link-hide').show();
});
jQuery('#additional-fields-container-link-hide').click(function(){
event.preventDefault();
jQuery('#additional-fields-container').hide();
jQuery('#additional-fields-container-link-hide').hide();
jQuery('#additional-fields-container-link-show').show();
});
});
Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar