Skip to content

Commit 737f419

Browse files
authored
Merge pull request #68 from k1sul1/patch-6
Add documentation to client side callbacks
2 parents 70cc917 + 16819db commit 737f419

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", array( "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)