Getting Started
- Open the desired form in the Form Editor.
Open your Browser Console
Copy and paste this snippet into the console. Now the
gwChangeFieldId()
function is available for use on this page.Provide the current field ID and the new field ID to the
gwChangeFieldId()
function. Here is an example where current field ID is 4 and the new field is 12gwChangeFieldId( 4, 12 );
Click the “Update Form” button to save your changes.
Parameters
currentFieldId (int) (required)
The current field ID of the field for which you would like to change the ID.
newFieldId (int) (required)
The new field ID to which you would like to set the current field.
Any questions?
We’re always happy to answer questions. How does solution works for you? Why did you need to change your field IDs? Let us know in the comments below!
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
Lifesaving! Thanks a lot :)
Hi Agnes,
You’re welcome. Glad to know the snippet was useful to you.
Best,
This is amazing!! So helpful!
Thanks. Glad to know it’s helpful.
Hi, amazing solution. Very much needed to alter complex calculation fields and alter som input fields.
Still think it crazy this is not built in Gravityform UX itself! This is a developer solution, not a regular wp user solution. Any idea if there is a Gravity form add-on for this?
Hi Keesjan,
Glad it seems useful for you! We are not aware of any add-ons like this currently.
Best,
Is there something similar but change the acutal FORM ID (not the field)? Otherwise, this one worked great!
Hi Simon,
We currently do not have a snippet for this. I’ll pass this over to our developers to get their input. If we’re able to come up with a snippet, we’ll let you know by replying to this comment.
Best,
Hey Simon, best way to change a form ID would be do so directly in the database. Do you have access to your site’s database?
This is BRILLIANT. I have been wanting a tool for this for a long time!
I used a bit more geekery: (1) WPCLI and the Gravity Forms CLI plugin to dump my list of 200+ fields (it’s a big form) to a csv file. (2) With the help of a spreadsheet, I generated the “from” and “to” IDs for the function. I copied the whole column into the console all at once. It worked flawlessly.
For others coming later, be careful to avoid possible field number collisions!
If your form currently has these field IDs, 8, 2, 5, 3, 6
you can’t go directly to 1, 2, 3, 4, 5
8 -> 1 (OK) 2 -> 2 (OK) 5 -> 3 (CONFLICT) 3 -> 4 (OK) 6 -> 5 (OK)
A workaround: 8 -> 101 (OK) 2 -> 102 (OK) 5 -> 103 (OK) 3 -> 104 (OK) 6 -> 105 (OK)
If you really want to start at 1, you can repeat it and go from 101 -> 1, 102 -> 2, etc. 101 -> 1 (OK) 102 -> 2 (OK) 103 -> 3 (OK) 104 -> 4 (OK) 105 -> 5 (OK)
Thanks again for the great tool.
TJ
Hi TJ,
Thanks for sharing this information.
Best,
What an amazing solution!!!
Thank you!!!
So incredibly clever, team! Saved my skin.
Having some trouble getting this to work…it looks from the video like maybe the form editor has changed? When I paste the snippet into console and then enter the parameters, I get the message “ReferenceError: form is not defined”
Hi Charles,
I just tested the snippet again, and it works as expected. Can you confirm if you’re running the code on the Form Editor page?
Best,
This is a great help!! Thx for posting this!
Not working for me neither :S
It says: VM4599:1 Uncaught ReferenceError: gwChangeFieldId is not defined at :1:1
Hi Javier,
I just tested this on my end with GF 2.5.1 and it works as expected. Please note that you will have to first copy, paste and run the snippet in the browser console, before calling the function with the ID parameters. In case you’re still having issues with it, you can pick up a Gravity Perks license and get in touch with us via our Support form, so we can dig into this further.
Best,
Just wanted to say thanks for this!
If the new field ID is larger than form.nextFieldId then you should also update form.nextFieldId to one greater than the new field ID, or else you might have problems when fields are later added to the form.
This is some fantastic. Thanks for this!
Wow. Cool. A huge time saver when creating bulk gravity forms. Helps a lot when you have to create similar forms many times over in different contexts Gravity forms plugin with gravity perks plugins is now a must have for any wordpress based software now. No other plugin comes even close. thanks.
Hey Arvind, Thank you so much for the kind words. We hope you continue to enjoy all our awesome snippets and perks. ๐
Thanks. This is helpful.
I had no idea you could use the browser’s console as a “terminal”
Hi there,
The video is not working.
Hello Crystal, Thank you for that informtion. I have updated the page so the video should be working correctly now. Have a great day! ๐