GRAVITY PERKS COPY CAT
What does it do?
The Copy Cat perk allows you to configure a checkbox which, when clicked, will copy the values from one field to another. This is particularly useful for situations like specifying a billing and shipping address. There is a good chance the user would desire to enter the same address for both fields. With Copy Cat, you can configure a checkbox to copy the user-entered values from the billing address field to the shipping address field.GRAVITY PERKS COPY CAT
GRAVITY PERKS COPY CAT
This also supports simply copying the value from one field to another after the user has entered a value. For example, the user could enter their first and last name into a field and you could automatically populate this into the Name input on the Credit Card field.GRAVITY PERKS COPY CAT
GRAVITY PERKS COPY CAT
How does it work?
This perk uses Javascript to copy all of the values from one field to another when the configured checkbox is clicked. It supports both single input fields (like the Single Line Text field) and complex input fields (like the Address field).GRAVITY PERKS COPY CAT
How do I enable this functionality?
The Copy Cat perk can be activated by adding a specially formatted CSS class to any checkbox field.
copy-{fieldId}-to-{fieldId}
Replace the first {fieldId}
with the ID of the field you will be copying from and the second {fieldId}
with the ID of the field you will be copying to. This custom class can be added to any Checkbox field via the “CSS Class Name” setting under the Advanced tab.GRAVITY PERKS COPY CAT
![](https://gravitywiz.com/wp-content/uploads/2013/06/gp-copy-cat-css-class.png)
GP Copy Cat CSS ClassUse the field ID to copy all inputs of a field into another field. Use the input ID if you want to copy to or from a specific input. When in doubt, just use the field ID.
Step by Step
Below are step by step instructions for activating this functionality on any Gravity Form. These instructions assume that your form already contains both the field you would like to copy the values from as well as the field you would like to copy the values to.GRAVITY PERKS COPY CAT
- Navigate to the Gravity Forms Form Editor.
- Select the form for which you would like to add this functionality.
- Add a “Checkboxes” field to your form.
- Remove all but one of the three default “Choices” and rename the remaining choice to better indicate what it will do.
In my example above, I am copying the Billing Address to the Shipping Address field so I’ve labeled it, “Same as billing Address.”
- Navigate to the “Advanced” settings by clicking the “Advanced” tab.
- Enter the specially formatted Copy Cat class (as indicated above) for the “CSS Class Name” setting.
If you have other classes in this field, that is no problem. Just add a space after the last existing class and add the Copy Cat class after it.
Supported Fields
- Standard Fields: Single Line Text, Paragraph, Drop Down, Multi Select, Checkboxes, Number, Radio Buttons, Hidden
- Advanced Fields: Name, Date, Time, Phone, Address, Website, Email, List
- Post Fields: Title, Body, Excerpt, Tags*, Category*, Custom Field*
- Product Fields: Product*, Quantity, Option*, Shipping
Note: While this is the official list of supported fields, it is not an exhaustive list. Many other fields may be supported depending on their configuration.
(*) Field is supported if configured to use a supported input type.
Tips & Tricks
Copying Multiple Fields
If you’d like a single checkbox to copy the values from one field to multiple other fields, just append another Copy Cat CSS class.
copy-{fieldId}-to-{fieldId} copy-{fieldId}-to-{fieldId}
Translated into some sample field ID fields, it would like like this:
copy-1-to-2 copy-1-to-3
Copying Multiple Fields to Multiple Fields
Using the same concept as copying multiple fields, we can also copy multiple fields to other fields.
copy-1-to-2 copy-3-to-4 copy-5-to-6
This would allow you to copy multiple groups of fields to another group of fields in a single batch. A good use case for this functionality is when you need to copy all billing information (name, phone number, email, etc) to the shipping portion of your form (assuming you are doing some form of ecommerce with Gravity Forms).GRAVITY PERKS COPY CAT
Automatically Copy One Field to Another Field
GP Copy Cat also supports automatically copying one field to another. To accomplish this, you would add the Copy Cat class to the “source” field rather than the “target” field. For example, if you want to copy a value from field ID 1 to field ID 2, you would add the class to field ID 1 and it will then automatically copy that value into field ID 2.GRAVITY PERKS COPY CAT
Target Specific Inputs of Multi-input Fields
Some fields, like the Address and Name field, have multiple inputs. You can copy from or copy to a specific input but referencing the input ID in the copy cat class.
- Copy Last Name from one Name field to another
copy-1.3-to-2.3
- Copy First and Last Name to Credit Card “Name” Input
copy-1-to-3.5
- Copy “State” input from Address field to a Single Line Text field
copy-4.4-to-6