Trigger submit button of the other form

Is there a way to trigger another submit button of another form?

Let say I have form A and form B.

I hit the submit button of form A. I also want form B to be submitted as well.

Hi @joshjosh

Can you try this?

TB.render('component_X',function(data){
    data.ele.find('.af-form-submit').on('click',function(){
        $($('.form-2 .af-form-submit')[0]).click();
    });
});

You’ll need to add an additional CSS class for the second form (the one you want to automatically submit).

Change “component_X” to the first forms ID and “.form-2” to whatever you put for the "Additional CSS class” in the page builder.

To get the form ID, hover over the :information_source: (i with a circle) symbol at the top of the component

3 Likes

It works! Thanks Tim!

1 Like