What is the trick to getting the CMS item ID into a form in Webflow for updating an item on form submit in Logic for the first time?

Published on
September 22, 2023

To get the CMS item ID into a form in Webflow for updating an item on form submit in Logic for the first time, you can follow these steps:

  1. Create a dynamic form using the Webflow CMS. Make sure to include all the necessary fields for updating the CMS item.

  2. Add a hidden input field in your form. This field will be used to store the CMS item ID.

  3. In the settings for the hidden input field, select "Get ID from" and choose the collection that contains the CMS items.

  4. In the form settings, select "Custom attributes" and add a new attribute called "data-item-id". Set the value of this attribute to the dynamic field that holds the CMS item ID.

  5. Publish your site to get the live URL.

  6. In your custom logic or backend code, retrieve the CMS item ID from the form submission. You can access it using the name or ID attribute of the hidden input field.

By following these steps, you can ensure that the CMS item ID is included in the form submission. This allows you to identify and update the correct CMS item using the Logic or backend code.

Note: It's important to have a proper validation check in place to ensure that the submitted CMS item ID is valid and corresponds to an existing item in the CMS.

The trick to getting the CMS item ID into a form in Webflow for updating an item on form submit in Logic for the first time is to:

  1. Create a dynamic form using the Webflow CMS.
  2. Add a hidden input field to store the CMS item ID.
  3. Retrieve the CMS item ID from the hidden input field in your custom logic or backend code.

Additional Questions:

  1. How do I create a dynamic form using the Webflow CMS?
  2. How can I add a hidden input field in Webflow?
  3. What is the purpose of the "data-item-id" attribute in the form settings?