0

I'm using Gravity Forms and after submission I want to use its built-in action add_action( 'gform_after_submission', 'after_submission', 10, 2 ); to trigger a couple of click events from 2 different elements in that page. Is it possible? If so, how is it done?

0

That's not possible (well, not without building super weird things). Action hooks are server side in PHP, clicks happen on the client side.

You should probably use JavaScript to run the actions when the form is submitted. With jQuery, this could be as easy as

jQuery("#formid").submit( function() {
    jQuery("#someButton").click();
});

Depending on what else you need to verify first.

0

It seems it's not really necessary to use php for this, but just bind will do the trick:

$(document).bind('gform_confirmation_loaded', function($){
    $("button").trigger("click");
});

And that's it! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.