Forums › Forums › Search & Filter Pro › Overriding the 'Auto submit form' for selected pages?
- This topic has 4 replies, 3 voices, and was last updated 6 years, 4 months ago by Anonymous.
-
Anonymous(Private) July 25, 2018 at 10:27 am #183401
Hello,
I S&F configured for my WooCommerce Shop (so I can’t have more than 1 instance), however on an internal page I need the Auto submit form setting enabled, but then have it turned off for when the do_shortcode is added to the homepage. Is there a way of overriding the default section using a hook/action perhaps?
Trevor(Private) July 25, 2018 at 10:43 am #183404I am not aware of a way to do this. It would require Custom javascript on that one page to unbind the on change listener that is attached to the form, and I do not know how to do this. It would also require a submit button.
I can ask Ross if he knows? I will flag this for him to look at.
Ross Moderator(Private) July 26, 2018 at 3:57 pm #183617Hi Christian
Although untested and undocumented, I think there is a way this could work.
There is an attribute on our
<form>
tag, which is passed to JavaScript to enable this functionality –data-auto-update
You can change this using our undocumented filter (I didn’t want to make this public as I’m thinking of changing the implementation in v3) –
search_filter_form_attributes
Example usage would be:
function filter_sf_atts( $atts, $sfid ) { //if search form ID = 225, the do something with the atts if($sfid==225) { //modify $atts here before returning it $atts['data-auto-update'] = '0'; } return $atts; } add_filter( 'search_filter_form_attributes', 'filter_sf_atts', 20, 2 );
Hope that helps!
-
AuthorPosts