Enhancement request – call jQuery.trigger when form loaded
-
I have code that reads the selected variation(s) and updates a hidden field in a CF7. The field is created by CF7 Dynamic Text Extension.
With the WooCommerce Quote or Enquiry Contact Form 7 plugin the hidden field is cleared when the popup is opened (because the reset() call in wqoecf-front-script.js file).
Can you please add a .trigger() call when the form is loaded. This will allow my code wait until after the reset() call to copy the variation information to the hidden field.
Here is the diff for wqoecf-front-script.js:
--- wqoecf-front-script.orig.js 2023-02-27 13:52:57.228089700 +0000 +++ wqoecf-front-script.js 2023-02-27 20:42:01.061386300 +0000 @@ -12,7 +12,7 @@ jQuery(".wqoecf-pop-up-box .wpcf7 > form").init(".wqoecf-pop-up-box .wpcf7 > form"); - jQuery(".wqoecf-pop-up-box").fadeIn(); + jQuery(".wqoecf-pop-up-box").fadeIn().trigger( 'wqoecf_popup_shown' ); }); jQuery(document).on("click", ".wqoecf-pop-up-box form.submitting .wpcf7-submit", function (e) {
The change is to add .trigger(‘wqoecf_popup_shown’).
Then my code can run like:
jQuery('body').on('wqoecf_popup_shown', function(){ copyVariationsToInput(); });
- The topic ‘Enhancement request – call jQuery.trigger when form loaded’ is closed to new replies.