Gravity Forms – 5 Digit Zip Codes & State Abbreviations

Originally based on the code by Matthew Connerton on the Gravity Forms support site, I have modified his original code to also trim the zip code into the first 5 digits.

Currently with Gravity Forms, there is no (easy) way to change the input fields to only accept 5 digits (or any other number) and/or change the submitted state selection to their USPS equivalents. If you’re trying to use your data to generate mailing labels or anything similar, the way it is setup can be messy and/or problematic.

Hence, the solution Mr. Connerton, and now myself, have developed. It is written as a plugin so all you have to do is download the file below, unzip it and put it in your WordPress plugins folder. It will then modify the submitted entry prior to it being saved to your database, and BAM! You’re a happy camper.

So what does this plugin do in short? –

  • Trim submitted zip codes to 5 digits
  • Convert full state names to their USPS state abbreviations

Enjoy! > State and Zip Code Modifier for Gravity Forms (7102)

Note: the link to Gravity Forms only works if you’re logged in to their support forums.

Comments (1)

Leave a Comment




    • Marty has been an active search marketing professional for over 12 years. He has consulted with the Fortune 100 and Fortune 500 as well as medium to small B2B and B2c businesses, governments and higher ed.