Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tyxla/Gravity-Forms-Multiple-Form-Instances
Allows multiple instances of the same form to be run on a single page when using AJAX.
https://github.com/tyxla/Gravity-Forms-Multiple-Form-Instances
gravity-forms wordpress
Last synced: 3 months ago
JSON representation
Allows multiple instances of the same form to be run on a single page when using AJAX.
- Host: GitHub
- URL: https://github.com/tyxla/Gravity-Forms-Multiple-Form-Instances
- Owner: tyxla
- License: gpl-2.0
- Created: 2014-10-27T22:23:45.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T09:20:01.000Z (4 months ago)
- Last Synced: 2024-07-09T11:55:16.337Z (4 months ago)
- Topics: gravity-forms, wordpress
- Language: PHP
- Size: 59.6 KB
- Stars: 38
- Watchers: 7
- Forks: 22
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-gravity-forms - Gravity Forms: Multiple Form Instances - Allows multiple instances of the same form to be run on a single page when using AJAX. (Third-Party Add-Ons)
README
# Gravity Forms: Multiple Form Instances
[![Build Status](https://travis-ci.org/tyxla/Gravity-Forms-Multiple-Form-Instances.svg?branch=master)](https://travis-ci.org/tyxla/Gravity-Forms-Multiple-Form-Instances) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tyxla/Gravity-Forms-Multiple-Form-Instances/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/tyxla/Gravity-Forms-Multiple-Form-Instances/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/tyxla/Gravity-Forms-Multiple-Form-Instances/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/tyxla/Gravity-Forms-Multiple-Form-Instances/?branch=master)
-----
#### About
**Gravity Forms: Multiple Form Instances** is a small plugin for WordPress.
Used in conjunction with the awesome [Gravity Forms](http://www.gravityforms.com/) plugin.
Allows multiple instances of the same form to be displayed on a single page when using AJAX.
-----
#### Installation & Configuration
This plugin does not need any customization.
Simply install and activate it, and it will do its magic with your Gravity Forms.
-----
#### How It Works
In order for the magic to work, various occurences of the form ID are replaced with a random ID when rendering the form. This allows for multiple instances of the same form to be submitted without having the issue of submitting form B when submitting form A.
If a form has already been submitted, the submitted random ID will be preserved and used for the next submissions as well, otherwise a new unique ID is generated.
-----
#### Customization (actions & filters)
The plugin uses the default `gform_get_form_filter` Gravity Forms filter for performing the replacement.
Additionally, the plugin offers the following actions & filters:
##### gform\_multiple\_instances\_strings
**$strings** *(array)*. An array of find => replace pairs. Occurences of "key" will be replaced with the corresponding "value".
**$form_id** *(int)*. The original form id.
**$random_id** *(int)*. The new, randomly generated form id.
This filter allows you to modify the default strings that will be replaced. The keys are the original strings, and the corresponding values are the strings that keys will be replaced with.