# Product form event

* To append custom data to the form data of Smind sections before submission, you can listen to the **"smind:product-form:before-submit"** event.

```
document.addEventListener('smind:product-form:before-submit', (event) => {
    try {
        const formData = event.detail.formData;

        if (this.sectionId === formData.get('section-id')) {
            formData.append('custom_key', custom_value);
        }
    } catch (error){
        console.log('error: ', error)
    }
});
```

```
custom_value: This is the element you want to add to the Smind add-to-cart form.
```

* After completing the "Add to Cart" action with a product using Smind's section, if you want to perform additional actions after the submission is completed, you can listen to the **"smind:product-form:submit-complete"** event.

```
document.addEventListener('smind:product-form:submit-complete', (event) => {
        try {
         // Handle the action you want to perform after adding to cart here.
        } catch (error) {
          console.log('error: ', error
        }
      })
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smind.io/dev/product-form-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
