Skip to content

Commit

Permalink
remove autoMountForms from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rockwellll committed Oct 14, 2024
1 parent 2c0ae3e commit c79f8ae
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ Hellotext.initialize('HELLOTEXT_BUSINESS_ID', configurationOptions)

#### Configuration Options

| Property | Description | Type | Default |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|---------|
| session | A valid Hellotext session which was stored previously. When not set, Hellotext attempts to retrieve the stored value from `document.cookie` when available, otherwise it creates a new session. | String | null |
| autoGenerateSession | Whether the library should automatically generate a session when no session is found in the query or the cookies | Boolean | true |
| autoMountForms | Whether the library should automatically mount forms collected or not | Boolean | true |
| Property | Description | Type | Default |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------------------------------------|
| session | A valid Hellotext session which was stored previously. When not set, Hellotext attempts to retrieve the stored value from `document.cookie` when available, otherwise it creates a new session. | String | null |
| autoGenerateSession | Whether the library should automatically generate a session when no session is found in the query or the cookies | Boolean | true |
| forms | An object that controls how Hellotext should control the forms on the page. See [Forms](/docs/forms.md) documentation for more information. | Object | { autoMount: true, successMessage: true } |
17 changes: 17 additions & 0 deletions docs/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ Then let Hellotext handle building the form, collecting, validating and authenti

For more information on how to create a form from the dashboard, view this [guide](https://help.hellotext.com/forms).

### Configuration

Hellotext forms have a default configuration that can be overridden by passing an object when initializing the library. It has the following attributes by default:

- `autoMount`: Automatically mount forms to the DOM when a `form` element with the `data-hello-form` attribute is found. Default is `true`.
- `successMessage`: Display a contextual success message when a form is submitted successfully. Default is `true`.
You can turn this off by setting it to `false`, or provide your custom success message by setting it to a string.

```javascript
Hellotext.initialize('HELLOTEXT_BUSINESS_ID', {
forms: {
autoMount: true,
successMessage: 'Thank you for submitting the form'
}
})
```

### Collection Phase

Hellotext uses the `MutationObserver` API to listen for changes in the DOM, specifically new form elements being added that have the `data-hello-form` attribute.
Expand Down

0 comments on commit c79f8ae

Please sign in to comment.