| 1 | const el = await webflow.getRootElement(); // Get root element |
| 2 | |
| 3 | // Check for an element |
| 4 | if (!el || !el.children) throw new Error("Expected an element"); |
| 5 | |
| 6 | // Create a form element |
| 7 | const formEl = await el.append(webflow.elementPresets.FormForm); |
| 8 | |
| 9 | // Check for App Connections |
| 10 | if (!formEl || !formEl.appConnections) { |
| 11 | throw new Error("App Connections not supported"); |
| 12 | } |
| 13 | |
| 14 | // Set App Connection |
| 15 | await formEl.setAppConnection("myAwesomeAppManageFormElement"); |
| 16 | |
| 17 | // Get existing App Connections |
| 18 | const connections = await formEl.getAppConnections(); |
| 19 | |
| 20 | // Remove first App Connection |
| 21 | const connection = connections[0]; |
| 22 | await removeAppConnection(connection); |