Form submit - is it possible to trigger from a button outside of the form?

Hi Weweb community,

  1. I’ve created a form called “New directory form” and placed it on a modal.

  2. Then I tried to trigger the “form submit” by “on click” event of a “Continue” button. The button is placed outside of the form.

  3. As a result, I expected that all my actions inside “On submit” form event would be executed, but none of them were.

Sorry for the large screenshot, I was able to upload only one file.

Am I doing something wrong?

There’s no specific case I want to implement. I know that I can achieve the desired result by using “Submit button” type inside the form. Just trying to understand the form submit behavior in order to know all the capabilities and to know what to expect :slight_smile:

Hi, it needs to be inside the form container.

This is wrong. It is possible and super easy. FYI @danlopes

  1. Create the form, give it an ID

  2. Create a button, set it to type Submit Button and add a custom attribute of form, value of it should point (refer) to the id you gave to your form, in my case it’s bro-form

Great thanks @Broberto for the comprehensive explanation!

1 Like