Skip Navigation

[Resolved] search form reset jquery event handler?

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by a.R 1 year, 12 months ago.

Assisted by: Waqar.

Author
Posts
#2351945

a.R

In hidden link, jQuery seems to be resetted when search form is resetted, but there is no event handler to restore jQuery?

#2352277

Waqar
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting us and I'd be happy to assist.

From looking into the page's code, I noticed this custom script is included through the template's "JS editor":


jQuery(document).ready(function($) {
	$('form[id^="cred_form_4485"]').on('submit', function() {
	    $(this).closest('.archiveintrag').hide(1500);
	});
});

  jQuery(document).on('js_event_wpv_pagination_completed', function(event, data) {
	$('form[id^="cred_form_4485"]').on('submit', function() {
	    $(this).closest('.archiveintrag').hide(1500);
	});
  });

    jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
	$('form[id^="cred_form_4485"]').on('submit', function() {
	    $(this).closest('.archiveintrag').hide(1500);
	});
	
});

Only the first instance of the script function is properly using the jQuery in safe/compatibility mode.
( ref: hidden link )

To fix it, you can update the script, so that it covers all 3 events ( "ready", "js_event_wpv_pagination_completed", and "js_event_wpv_parametric_search_form_updated" ) from a single function:


jQuery( document ).on( 'ready js_event_wpv_pagination_completed js_event_wpv_parametric_search_form_updated', function( event, data ) {

	jQuery('form[id^="cred_form_4485"]').on('submit', function() {
	    jQuery(this).closest('.archiveintrag').hide(1500);
	});
   
});

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2352579

a.R

Thank you, Waqar.
But this doesn´t help.

#2352581

a.R

E.g. on hidden link, pressing "Biete" will make that button yellow.
After resetting that form, that doesn´t work anymore.

#2352669

Waqar
Supporter

Languages: English (English )

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

Thanks for writing back.

During troubleshooting, I noticed that as soon as the reset button is used, there is a script error generated in the browser's console, which originates from this part of the custom code:


jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
	$('form[id^="cred_form_4485"]').on('submit', function() {
	    $(this).closest('.archiveintrag').hide(1500);
	});

When a script error like this is encountered, it stops any further execution of scripts. This is why I suggested the changes in the script, in my last message.

You can either make those changes from my last message or at least replace the "$" with "jQuery" in the code snippet, mentioned above and then check the working of the other custom scripts again.

I hope this explanation will make it more clear.

#2352763

a.R

Ok, sorry. I´m lacking experience...

THANK YOU, WAQAR 🙂

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