Skip to content

Allows multiple instances of the same form to be run on a single page when using AJAX.

License

Notifications You must be signed in to change notification settings

ajoah/Gravity-Forms-Multiple-Form-Instances

 
 

Repository files navigation

Gravity Forms: Multiple Form Instances

Build Status Scrutinizer Code Quality Code Coverage


About

Gravity Forms: Multiple Form Instances is a small plugin for WordPress.

Used in conjunction with the awesome Gravity Forms 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.

About

Allows multiple instances of the same form to be run on a single page when using AJAX.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 90.9%
  • Shell 9.1%