Skip Navigation

[Resolved] Prevent double event ‘js_event_wpv_parametric_search_form_updated’

This thread is resolved. Here is a description of the problem and solution.

Problem:
I am trying to use bootstrap-select (https://silviomoreto.github.io/bootstrap-select/examples/) with drop-down selectors for a custom search form. Each drop-down box gets a class 'selectpicker'.
The custom search settings are: 'AJAX results update when visitors change any filter values'.
The event 'js_event_wpv_parametric_search_form_updated' display dialogue box two times.

Solution:
I assume you are using this custom select feature to style the dropdown. We already have this ajax function available in View >> Custom Search Settings, screenshot here: https://d7j863fr5jhrr.cloudfront.net/wp-content/uploads/2017/06/536029-Custom_serach.png?x72603

- This will require custom coding, you can try out the solutions posted here:
https://stackoverflow.com/a/14991189
https://stackoverflow.com/a/29152483

- You might also want to remove your selectpicker refresh method which can help.

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Mario 7 years, 5 months ago.

Assisted by: Noman.

Author
Posts
#535961

I am trying to: use bootstrap-select (hidden link) with drop-down selectors for a custom search form. Each drop-down box gets a class 'selectpicker'.

The custom search settings are: 'AJAX results update when visitors change any filter values'.

I visited this URL: hidden link

With every change within the drop-down elements, it needs to initialize/refresh again.
So i use

jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
  alert('Form ' + data.view_unique_id + ' reloaded');
  jQuery('.selectpicker').selectpicker('refresh');
});

I expected to see: just one refresh event for the select-box and just one load of the results.

Instead, I got: The event 'js_event_wpv_parametric_search_form_updated' fires two events, and the results loaded two times. The alert box pops up two times.

So question is, how could i disable/unregister the eventListener for the second event to occur?
Would be nice if you could point me in the right direction. Thanks in advance.

#536029

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Custom serach.png

Hi Daniel,

Thank you for contacting Toolset support.

With every change within the drop-down elements, it needs to initialize/refresh again.
==> I assume you are using this custom select feature to style the dropdown. Because we already have this ajax function already available in View >> Custom Search Settings (please see attached screenshot)

- You can try out the solutions posted here:
https://stackoverflow.com/a/14991189
https://stackoverflow.com/a/29152483

- You might also want to remove your selectepicker refresh method which can help.

Further, if you want to use custom js code then we cannot consult anything on the custom code as per the support policy. https://toolset.com/toolset-support-policy/

We have some recommended list of service providers here if you would like to take a look: https://toolset.com/consultant/

Have a great day, Thank you

#536463

Thank you, Norman.