Skip to content

Commit 65fe6c7

Browse files
authored
Add documentation to client side callbacks
1 parent 70cc917 commit 65fe6c7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ window.wplf.errorCallbacks.push(() => alert('Form submission failed!'));
165165

166166
These callbacks are executed in the order they appear.
167167

168+
To avoid running your JavaScript too early, add `wplf-form-js` to your enqueue dependencies:
169+
```php
170+
wp_enqueue_script("themejs", "/path/to/theme.js", ["wplf-form-js"], ...);
171+
```
172+
Otherwise you might run into errors like "Cannot read property 'push' of undefined".
173+
168174
## Multilingual
169175

170176
You can create multilingual forms using Polylang. WPLF will register and automatically fetch the translation when you use special template tags.

0 commit comments

Comments
 (0)