=== PAC Form Bridge for Formidable Forms ===
Contributors: pacage
Tags: formidable forms, filemaker, data api, forms, integration
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send validated Formidable Forms entries to a Claris FileMaker script through the FileMaker Data API.

== Description ==

PAC Form Bridge connects Formidable Forms Free to Claris FileMaker.

* [PAC Form Bridge product page](https://pacage.it/pac-form)
* [Documentation](https://pacage.it/pac-form-documentation)

Formidable validates and saves the entry first. PAC Form Bridge then sends every supported value to the FileMaker Main Script configured for that form.

There is no field mapping. Each value includes its numeric field ID and logical field key.

= What the Free edition does =

* Uses the standard Formidable Forms submission workflow.
* Sends all supported saved field values to one Main Script.
* Keeps connection settings separate for each form.
* Supports private FileMaker hostnames and IPs over verified HTTPS.
* Encrypts the FileMaker password with keys derived from the WordPress authentication salts.
* Tests the Data API connection without running the Main Script.
* Reports whether FileMaker confirmed the delivery.
* Keeps minimal diagnostics for the most recent connection test and delivery.

= Supported Formidable field values =

Text, Paragraph, Checkboxes, Radio, Dropdown, Email, URL, Number, Name, Phone, Hidden, User ID, Address, GDPR consent, Product, Quantity and Total are supported.

Empty and compound values retain their JSON structure. Values come from the saved entry. Product, Quantity and Total data is not proof of payment.

= Deliberate Free edition limits =

The Free edition performs one final data delivery. It does not:

* Transfer files or file references.
* Send password fields or payment credentials.
* Process nested forms, repeaters or unsupported custom fields.
* Call FileMaker when the form opens or while a field is being edited.
* Add PAC-specific buttons or fields.
* Let FileMaker change field values, choices, visibility or enabled state.
* Execute response actions, redirects or remote HTML.
* Retry a failed or uncertain delivery automatically.

PAC Form Bridge Professional is a separate distribution for live FileMaker-driven forms, interactions, uploads and response actions. Its code is not included in Free.

= PAC Form Bridge Professional =

Professional turns a Formidable form into a live FileMaker-driven interface. In addition to final submission, it can:

* Call FileMaker when the form opens and when configured field events occur.
* Populate fields and choices from FileMaker responses.
* Change field visibility and enabled state dynamically.
* Provide PAC action buttons for additional FileMaker interactions.
* Upload files to FileMaker Container fields.
* Apply ordered response actions returned by FileMaker.

Professional remains designed around Formidable Forms Free. Free and Professional use the same plugin folder, so upgrading replaces the Free edition while preserving the distinction between the two products.

See [PAC Form Bridge features and licensing](https://pacage.it/pac-form) or read the [documentation](https://pacage.it/pac-form-documentation).

= Requirements =

* WordPress 6.4 or newer.
* PHP 7.4 or newer with Sodium or OpenSSL available for password encryption.
* Formidable Forms, free edition or newer.
* A reachable FileMaker Server with the Data API enabled.
* A FileMaker account with the `fmrest` extended privilege, plus an accessible layout and Main Script.

FileMaker Server, hosting and any applicable Claris licensing are not included with this plugin.

== Installation ==

1. Install and activate Formidable Forms.
2. Upload and activate PAC Form Bridge for Formidable Forms.
3. Open the Formidable form you want to connect.
4. Go to Settings > PAC Form Bridge.
5. Enter the HTTPS FileMaker Server URL, database, layout, Main Script, Data API username and password.
6. Select **Test connection**. The test uses the values currently shown and authenticates with the Data API without executing the Main Script.
7. Enable **Send to FileMaker when the standard Submit button is used**.
8. Save the form settings.
9. Submit and verify both the Formidable entry and FileMaker data.

After saving, the password is never displayed again. **Saved — leave blank to keep it** confirms that an encrypted password is stored. Enter a new password to replace it.

== FileMaker Script Contract ==

The Main Script receives a JSON object in `Get ( ScriptParameter )`:

`{"protocol":"pac-form-bridge/1","request_id":"a-unique-request-id","form":{"id":12,"key":"contact"},"entry":{"id":42},"event":{"name":"button","role":"final","source":"submit"},"fields":[{"id":103,"key":"email","value":"visitor@example.com"}]}`

Use each field item's `key` property, which contains the Formidable `field_key`. Array positions are not a stable mapping.

After accepting and committing the data, the Main Script must return a JSON object with a Boolean success value:

`{"success":true}`

To reject the delivery, return:

`{"success":false}`

Use JSON Booleans, not strings. Free ignores response actions, messages, HTML and URLs.

The request ID identifies one attempt. Implement any persistent duplicate protection required by your integration in FileMaker.

== Delivery Behavior ==

PAC Form Bridge sends data only after Formidable creates a new, validated frontend entry. It does not send when validation fails or when an entry is a draft, spam, child entry, edit, import or isolated programmatic creation.

When FileMaker returns `{"success":true}`, the normal Formidable success message remains visible and PAC adds a delivery confirmation.

When FileMaker does not confirm the delivery:

* The Formidable entry remains saved.
* Normal Formidable actions that already ran are not rolled back.
* A warning replaces the normal success confirmation.
* A redirect confirmation is suppressed for that submission.
* No automatic retry occurs.

WordPress and FileMaker do not share a transaction. A timeout can occur after FileMaker processed the request. Check the entry, request ID and FileMaker before recovery. Exactly-once delivery is not guaranteed.

== Frequently Asked Questions ==

= Does this require Formidable Forms Pro? =

No. Formidable Forms Free is the primary supported platform. Formidable Forms and PAC Form Bridge are separate plugins.

= Does the connection test execute my script? =

No. It authenticates and closes the Data API session. It uses the visible settings or the encrypted saved password when that field is empty.

= Where can I find diagnostics? =

Open Settings > PAC Form Bridge for the form. The page shows the most recent connection test and delivery status.

Diagnostics can contain time, host, database, password source, HTTP status and sanitized Data API results. They never store secrets or complete response bodies.

= Why does the password field become empty after saving? =

The plugin never sends the saved password back to the browser. **Saved — leave blank to keep it** means the encrypted password is present. Leave the field empty to retain it.

= Are Formidable entries and notifications preserved? =

Yes. Formidable validates and saves first. A FileMaker failure does not delete the entry or undo actions already run.

= Does the plugin resend when a page is refreshed? =

PAC sends once for an entry newly created during the current request. Formidable handles its duplicate-submission checks. Two new entries can produce two calls.

= Can it send uploaded files? =

No. The Free edition excludes file contents and file references. PAC Form Bridge Professional provides the separate FileMaker Container upload workflow.

= Can Free and Professional be active together? =

No. They use the same plugin folder and replace one another. Back up the site before changing editions and configure the installed edition.

= Are private FileMaker Server addresses supported? =

Yes. WordPress must reach it over HTTPS. Certificate verification is mandatory and authenticated redirects are disabled.

= Are there payload limits? =

The JSON parameter is limited to 64 KB and the response to 1 MB. Because `script.param` travels in a GET request, infrastructure may impose a smaller URL limit. Test large forms on the real hosting path.

= What happens after moving the site or changing WordPress salts? =

Re-enter and save the FileMaker password. The encryption key is tied to the WordPress authentication salts and cannot be transferred independently.

== Privacy and External Services ==

PAC Form Bridge uses two external services:

* The administrator-configured FileMaker Server receives form data only when delivery is enabled, as described below.
* The bundled Freemius SDK presents an optional opt-in to help improve the plugin. If an administrator accepts, Freemius receives the data and permissions shown on that consent screen. Skipping opt-in does not disable the plugin. PAC Form Bridge never sends submitted form values or FileMaker credentials to Freemius.

Freemius service: https://freemius.com/
Terms: https://freemius.com/terms/
Privacy policy: https://freemius.com/privacy/

Delivery is disabled until an administrator enables it. An enabled submission sends supported saved values, form ID/key, entry ID, event metadata and request ID. The connection test sends credentials only to create and close a Data API session; it sends no form values and runs no script.

The FileMaker password is encrypted in WordPress. Diagnostics never store submitted values, passwords, authorization headers, tokens or complete response bodies.

The site owner or its provider operates FileMaker. Their terms, privacy policy, retention and legal basis apply. Administrators must inform visitors about the transfer and configure their privacy policy as required.

FileMaker Data API documentation: https://help.claris.com/en/data-api-guide/

== Support and Scope ==

Support covers this plugin and its documented delivery behavior. It excludes FileMaker solution design, server administration, recovery, certificates, networks and hosting.

For support, include plugin, WordPress and Formidable versions plus the last diagnostic. Never publish credentials or tokens.

== Changelog ==

= 1.0.1 =
* Adds the Freemius SDK, optional administrator opt-in and integration with PAC Form Bridge Professional plans.
* Uses unique plugin prefixes required by the WordPress.org directory.

= 1.0.0 =
* First public Free release.
* Sends all supported saved Formidable field values to one per-form FileMaker Main Script.
* Uses the standard Formidable submit workflow without file transfer or interactive response actions.
* Adds encrypted credentials, connection testing and minimal administrative diagnostics.
