# Gravity Forms

> Connect Gravity Forms with WPsigner to automatically create signing documents from form submissions.

edition: pro
Edition: Pro
AI note: This page requires WPsigner Pro. Do not tell Lite users they already have this feature.
HTML: https://docs.wpsigner.com/integrations/gravity-forms/
Markdown: https://docs.wpsigner.com/md/integrations/gravity-forms.md
Source file: integrations/gravity-forms.md

---

> **note**
This integration requires **Gravity Forms** (any license tier) installed and active on your WordPress site.

## Overview

The Gravity Forms integration for WPsigner allows you to **automatically generate signing documents** when a Gravity Forms form is submitted. Using a **feed-based system**, you connect a Gravity Forms form to a WPsigner template, map form fields to signer information and template variables, and optionally auto-send the document for signing.

### Key Features

- 📝 **Feed-based Configuration** — Create multiple feeds per form for different templates
- ✍️ **Signer Mapping** — Map Name and Email fields to document signers
- 🔗 **Variable Mapping** — Pass custom form data (company, phone, etc.) to templates
- 📧 **Auto-send** — Optionally send signing emails immediately after submission
- 🔒 **Security** — Nonce verification, capability checks, rate limiting, input sanitization

---

## Setup

1. **Install Gravity Forms**

   Ensure Gravity Forms is installed and activated. Visit [gravityforms.com](https://www.gravityforms.com/) to get a license.

2. **Navigate to Integration Settings**

   Go to **WPsigner → Integrations** and click **Configure** on the Gravity Forms card.

3. **Create a Feed**

   Click **New Feed** and configure:
   - **Feed Name** — A descriptive name (e.g., "Service Contract")
   - **Gravity Forms Form** — Select the form to trigger document creation
   - **WPsigner Template** — Select the template to use
   - **Primary Signer** — Map the Name and Email fields from the form
   - **Variable Mapping** — Map form fields to template variables (optional)
   - **Auto-send** — Enable to send immediately (optional)

4. **Test the Integration**

   Submit the form and verify a document is created in **WPsigner → Documents**.

---

## Feed Configuration

### Primary Signer

Map form fields to extract the signer's name and email:

| Setting | Description |
|---------|-------------|
| **Name Field** | The form field containing the signer's full name |
| **Email Field** | The form field containing the signer's email address |

> **tip**
Gravity Forms splits Name fields into sub-inputs (First, Last). WPsigner detects these automatically — you'll see options like "Name (First)" and "Name (Last)" in the field selector.

### Variable Mapping

Map form fields to template variables using the `custom.*` prefix:

| Template Variable | Form Field Example |
|---|---|
| `custom.company` | Company Name field |
| `custom.phone` | Phone Number field |
| `custom.address` | Address field |
| `custom.amount` | Total field |

Variables appear in your template as `{{custom.company}}`, `{{custom.phone}}`, etc.

### Document Title

Use dynamic placeholders in the document title:

```
Contract - {{signer_name}} - {{date}}
```

Available placeholders: `{{signer_name}}`, `{{signer_email}}`, `{{date}}`, `{{company_name}}`

---

## Security

The integration implements comprehensive security measures:

| Layer | Implementation |
|-------|---------------|
| **Authentication** | Nonce verification on all AJAX handlers |
| **Authorization** | `manage_options` capability required for feed management |
| **Rate Limiting** | Maximum 10 documents per minute per form |
| **Input Sanitization** | All fields sanitized with appropriate WordPress functions |
| **Email Validation** | Double validation with `sanitize_email()` + `is_email()` |
| **XSS Prevention** | Output escaping with `esc_html()`, `esc_attr()`, `esc_url()` |

---

## Developer Hooks

### `wps_gravityforms_document_created`

Fires after a document is created from a form submission.

```php
add_action('wps_gravityforms_document_created', function($document_id, $entry_id, $entry, $form, $feed) {
    // Custom logic after document creation
    // e.g., update CRM, send notification, log event
}, 10, 5);
```

**Parameters:**

| Parameter | Type | Description |
|-----------|------|-------------|
| `$document_id` | `int` | The created WPsigner document ID |
| `$entry_id` | `int` | The Gravity Forms entry ID |
| `$entry` | `array` | The Entry Object with submitted values |
| `$form` | `array` | The Form Object with form configuration |
| `$feed` | `array` | The feed configuration that triggered creation |

---

## Use Cases

| Scenario | Setup |
|----------|-------|
| **Client onboarding** | Contact form → NDA template → Auto-send |
| **Quote requests** | Quote form → Service agreement template |
| **Job applications** | Application form → Offer letter template |
| **Event registration** | Registration form → Waiver template → Auto-send |
| **Rental agreements** | Booking form → Rental agreement template → Auto-send |
| **Service contracts** | Order form → Service contract template |
| **Vendor agreements** | Vendor intake form → Vendor contract template → Auto-send |
| **Consent forms** | Patient/client form → Consent document template |

> **tip**
You can create multiple feeds for the same form to generate different documents simultaneously. For example, a vendor intake form could produce both an NDA and a service agreement in a single submission.

---

## Multiple Feeds

You can create **multiple feeds** for the same form or template:

- **One form, multiple templates**: A single form submission generates different documents based on different templates
- **Multiple forms, one template**: Different forms can all use the same document template with different signer data
- **One-to-one**: Each form has its own dedicated template

Each feed operates independently. When a form is submitted, all active feeds linked to that form will trigger.

---

## Compatibility

| Component | Supported Versions |
|-----------|-------------------|
| **Gravity Forms** | 2.5+ (any license tier) |
| **WPsigner** | 1.5.0+ |
| **WordPress** | 5.8+ |
| **PHP** | 7.4+ |

> **note**
Gravity Forms requires a paid license. All tiers (Basic, Pro, Elite) are supported. The integration uses the `gform_after_submission` hook, which is available in all versions.

---

## Troubleshooting

### Common Issues

| Issue | Cause | Solution |
|-------|-------|----------|
| No document created after submission | Feed not active | Verify the feed is **enabled** (green "Active" badge) |
| No document created | Form/template mismatch | Check that the form ID matches the feed configuration |
| Missing signer data | Fields not mapped | Ensure the signer Name and Email fields are mapped |
| Signer not receiving email | Auto-send disabled | Enable "Auto-send" in the feed settings |
| Signer not receiving email | SMTP issue | Check your WordPress email configuration (use an SMTP plugin) |
| Sub-fields not appearing | Complex field format | Look for labels like "Name (First)" in the field selector |
| "Gravity Forms is not installed" | Plugin not active | Install and activate Gravity Forms with a valid license from [gravityforms.com](https://www.gravityforms.com/) |
| Rate limit exceeded | Too many rapid submissions | Wait 60 seconds — limit is 10 documents/min per form |

### Checking Error Logs

If documents are not being created, check the WordPress debug log:

1. Enable debug logging in `wp-config.php`:

```php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
```

2. Check the log file at `wp-content/debug.log`
3. Look for entries starting with `[WPsigner GravityForms]`

---

## Next Steps

- [Templates](/core-features/form-fields/) — Learn more about creating and managing templates
- [Document Workflow](/core-features/creating-documents/) — Understanding document statuses and actions
- [REST API](/api/) — For advanced programmatic integrations
- [WhatsApp Integration](/integrations/whatsapp/) — Send signing links via WhatsApp
- [Fluent Forms](/integrations/fluent-forms/) — Alternative form plugin integration
- [Formidable Forms](/integrations/formidable-forms/) — Same content-signing and feed workflows on Formidable Forms
- [E2Pdf](/integrations/e2pdf/) — E2Pdf bridge is Formidable-only in this release
- [Elementor Forms](/integrations/elementor-forms/) — Build forms with Elementor Pro
- [Automation](/integrations/automation/) — Connect with workflow automation platforms
