Is it possible to identify each form submission based on which button was clicked in Webflow?

Published on
September 22, 2023

Yes, it is possible to identify each form submission based on which button was clicked in Webflow. Here's how you can achieve this:

  1. Add multiple buttons: Create multiple submit buttons within your form, each with a unique name or value attribute. For example, you could have buttons with names like submit-button-1, submit-button-2, etc.

  2. Add hidden field: Add a hidden field to your form to capture the value of the clicked button. To do this, drag and drop a text input field into your form and set its display property to hidden. Then, give it a name attribute, such as button-clicked.

  3. Set up interactions: In the Webflow Designer, switch to the Interactions panel and create a new interaction triggered by the click event on each button. Within the interaction, you can set the value of the hidden input field to the name or value attribute of the clicked button. For example, if the button has a name attribute set to submit-button-1, you would set the value of the hidden field to submit-button-1.

  4. Custom code: To ensure that the hidden field value gets submitted with the form, you'll need to add some custom code. Click on the form element and go to the Settings tab in the right-hand panel. Under the Custom Code section, add a custom attribute called onsubmit and set its value to return true. This ensures that the form is submitted even if it contains hidden fields.

  5. Accessing the data: When a user submits the form, the value of the clicked button will be included as a parameter in your form submission data. You can access this data on your backend or through third-party form submission services.

By following these steps, you'll be able to identify each form submission in Webflow based on which button was clicked.

Additional questions:

  1. How can I create multiple form buttons in Webflow?
  2. What is the purpose of a hidden field in a form?
  3. How do I access form submission data in Webflow for processing or storage?