<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Abbreviate City Fields</title>
		<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields</link>
		<description>Gravity Support Forums Topic: Abbreviate City Fields</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 02:56:50 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/abbreviate-city-fields" rel="self" type="application/rss+xml" />

		<item>
			<title>honeyl on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-44927</link>
			<pubDate>Sun, 25 Dec 2011 13:40:48 +0000</pubDate>
			<dc:creator>honeyl</dc:creator>
			<guid isPermaLink="false">44927@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I would be interested in having the state name converted to postal codes in the interface itself. I think most people know the postal codes by now, and it would certainly save room in the form where you could place city, state, and zip on the same line.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Chris Hajer on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-38557</link>
			<pubDate>Fri, 21 Oct 2011 12:59:29 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">38557@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This has not been added to the plugin in the latest version 1.6RC5.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>glynndevins on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-38553</link>
			<pubDate>Fri, 21 Oct 2011 12:44:48 +0000</pubDate>
			<dc:creator>glynndevins</dc:creator>
			<guid isPermaLink="false">38553@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Has this functionality been added to the plugin yet?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Marty Martin on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-20925</link>
			<pubDate>Mon, 21 Mar 2011 09:48:50 +0000</pubDate>
			<dc:creator>Marty Martin</dc:creator>
			<guid isPermaLink="false">20925@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;That plugin code works perfect, thanks.  Looking forward to this functionality being incorporated into the core.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Web Business Freedom on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-4368</link>
			<pubDate>Tue, 30 Mar 2010 13:40:05 +0000</pubDate>
			<dc:creator>Web Business Freedom</dc:creator>
			<guid isPermaLink="false">4368@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Here we go. I created a custom programing plugin and added this to it which will convert the long name to short name before it is posted/emailed.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
&#38;lt;?php
  /*
    Plugin Name: Custom Programming
    Plugin URI: &#60;a href=&#34;http://www.example.com/&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/&#60;/a&#62;
    Description: Plugin for altering gForms state data
    Author: Matthew Connerton
    Version: 1.0
    Author URI: &#60;a href=&#34;http://www.example.com/&#34; rel=&#34;nofollow&#34;&#62;http://www.example.com/&#60;/a&#62;
  */
add_action(&#38;quot;gform_pre_submission&#38;quot;, &#38;quot;pre_submission_state_handler&#38;quot;);
function pre_submission_state_handler($form_meta){
    foreach($form_meta[&#38;quot;fields&#38;quot;] as $field){
      if($field[&#38;#39;type&#38;#39;] == &#38;quot;address&#38;quot;){
         foreach($field[&#38;quot;inputs&#38;quot;] as $input){
            if($input[&#38;#39;label&#38;#39;] == &#38;quot;State / Province&#38;quot;){
              $value = $_POST[&#38;quot;input_&#38;quot; . str_replace(&#38;#39;.&#38;#39;, &#38;#39;_&#38;#39;, $input[&#38;quot;id&#38;quot;])];
              $_POST[&#38;quot;input_&#38;quot; . str_replace(&#38;#39;.&#38;#39;, &#38;#39;_&#38;#39;, $input[&#38;quot;id&#38;quot;])] = shortenState($value);
            }
        }
      }
    }
  }
function shortenState($state){
    if(strlen($state) == 2){
      $newState = $state;
    }else{
      $state = ucwords(strtolower($state));
      switch($state){
        case &#38;quot;District of Columbia&#38;quot;:
          $newState = &#38;quot;DC&#38;quot;;
          break;
        case &#38;quot;Alaska&#38;quot;:
          $newState = &#38;quot;AK&#38;quot;;
          break;
        case &#38;quot;Alabama&#38;quot;:
          $newState = &#38;quot;AL&#38;quot;;
          break;
        case &#38;quot;Arkansas&#38;quot;:
          $newState = &#38;quot;AR&#38;quot;;
          break;
        case &#38;quot;Arizona&#38;quot;:
          $newState = &#38;quot;AZ&#38;quot;;
          break;
        case &#38;quot;California&#38;quot;:
          $newState = &#38;quot;CA&#38;quot;;
          break;
        case &#38;quot;Colorado&#38;quot;:
          $newState = &#38;quot;CO&#38;quot;;
          break;
        case &#38;quot;Connecticut&#38;quot;:
          $newState = &#38;quot;CT&#38;quot;;
          break;
        case &#38;quot;Delaware&#38;quot;:
          $newState = &#38;quot;DE&#38;quot;;
          break;
        case &#38;quot;Florida&#38;quot;:
          $newState = &#38;quot;FL&#38;quot;;
          break;
        case &#38;quot;Georgia&#38;quot;:
          $newState = &#38;quot;GA&#38;quot;;
          break;
        case &#38;quot;Hawaii&#38;quot;:
          $newState = &#38;quot;HI&#38;quot;;
          break;
        case &#38;quot;Iowa&#38;quot;:
          $newState = &#38;quot;IA&#38;quot;;
          break;
        case &#38;quot;Idaho&#38;quot;:
          $newState = &#38;quot;ID&#38;quot;;
          break;
        case &#38;quot;Illinois&#38;quot;:
          $newState = &#38;quot;IL&#38;quot;;
          break;
        case &#38;quot;Indiana&#38;quot;:
          $newState = &#38;quot;IN&#38;quot;;
          break;
        case &#38;quot;Kansas&#38;quot;:
          $newState = &#38;quot;KS&#38;quot;;
          break;
        case &#38;quot;Kentucky&#38;quot;:
          $newState = &#38;quot;KY&#38;quot;;
          break;
        case &#38;quot;Louisiana&#38;quot;:
          $newState = &#38;quot;LA&#38;quot;;
          break;
        case &#38;quot;Massachusetts&#38;quot;:
          $newState = &#38;quot;MA&#38;quot;;
          break;
        case &#38;quot;Maryland&#38;quot;:
          $newState = &#38;quot;MD&#38;quot;;
          break;
        case &#38;quot;Maine&#38;quot;:
          $newState = &#38;quot;ME&#38;quot;;
          break;
        case &#38;quot;Michigan&#38;quot;:
          $newState = &#38;quot;MI&#38;quot;;
          break;
        case &#38;quot;Minnesota&#38;quot;:
          $newState = &#38;quot;MN&#38;quot;;
          break;
        case &#38;quot;Missouri&#38;quot;:
          $newState = &#38;quot;MO&#38;quot;;
          break;
        case &#38;quot;Mississippi&#38;quot;:
          $newState = &#38;quot;MS&#38;quot;;
          break;
        case &#38;quot;Montana&#38;quot;:
          $newState = &#38;quot;MT&#38;quot;;
          break;
        case &#38;quot;North Carolina&#38;quot;:
          $newState = &#38;quot;NC&#38;quot;;
          break;
        case &#38;quot;North Dakota&#38;quot;:
          $newState = &#38;quot;ND&#38;quot;;
          break;
        case &#38;quot;Nebraska&#38;quot;:
          $newState = &#38;quot;NE&#38;quot;;
          break;
        case &#38;quot;New Hampshire&#38;quot;:
          $newState = &#38;quot;NH&#38;quot;;
          break;
        case &#38;quot;New Jersey&#38;quot;:
          $newState = &#38;quot;NJ&#38;quot;;
          break;
        case &#38;quot;New Mexico&#38;quot;:
          $newState = &#38;quot;NM&#38;quot;;
          break;
        case &#38;quot;Nevada&#38;quot;:
          $newState = &#38;quot;NV&#38;quot;;
          break;
        case &#38;quot;New York&#38;quot;:
          $newState = &#38;quot;NY&#38;quot;;
          break;
        case &#38;quot;Ohio&#38;quot;:
          $newState = &#38;quot;OH&#38;quot;;
          break;
        case &#38;quot;Oklahoma&#38;quot;:
          $newState = &#38;quot;OK&#38;quot;;
          break;
        case &#38;quot;Oregon&#38;quot;:
          $newState = &#38;quot;OR&#38;quot;;
          break;
        case &#38;quot;Pennsylvania&#38;quot;:
          $newState = &#38;quot;PA&#38;quot;;
          break;
        case &#38;quot;Rhode Island&#38;quot;:
          $newState = &#38;quot;RI&#38;quot;;
          break;
        case &#38;quot;South Carolina&#38;quot;:
          $newState = &#38;quot;SC&#38;quot;;
          break;
        case &#38;quot;South Dakota&#38;quot;:
          $newState = &#38;quot;SD&#38;quot;;
          break;
        case &#38;quot;Tennessee&#38;quot;:
          $newState = &#38;quot;TN&#38;quot;;
          break;
        case &#38;quot;Texas&#38;quot;:
          $newState = &#38;quot;TX&#38;quot;;
          break;
        case &#38;quot;Utah&#38;quot;:
          $newState = &#38;quot;UT&#38;quot;;
          break;
        case &#38;quot;Virginia&#38;quot;:
          $newState = &#38;quot;VA&#38;quot;;
          break;
        case &#38;quot;Vermont&#38;quot;:
          $newState = &#38;quot;VT&#38;quot;;
          break;
        case &#38;quot;Washington&#38;quot;:
          $newState = &#38;quot;WA&#38;quot;;
          break;
        case &#38;quot;Wisconsin&#38;quot;:
          $newState = &#38;quot;WI&#38;quot;;
          break;
        case &#38;quot;West Virginia&#38;quot;:
          $newState = &#38;quot;WV&#38;quot;;
          break;
        case &#38;quot;Wyoming&#38;quot;:
          $newState = &#38;quot;WY&#38;quot;;
          break;
      }
    }
    return $newState;
  }
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Web Business Freedom on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-4365</link>
			<pubDate>Tue, 30 Mar 2010 11:41:46 +0000</pubDate>
			<dc:creator>Web Business Freedom</dc:creator>
			<guid isPermaLink="false">4365@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I just used gform_pre_submission to find the address field and convert the long name to a short name and assign it to the post data before it is saved and is working good.&#60;/p&#62;
&#60;p&#62;With permission from my client, I will post the code here.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-4360</link>
			<pubDate>Tue, 30 Mar 2010 11:31:41 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">4360@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Right now there isn't a hook for this specific change.  But it is something we will look at adding in the next release if we can work it in.  So keep track of this change if you go ahead and make it.&#60;/p&#62;
&#60;p&#62;Down the road we do plan on implementing the ability to select an option to use abbreviations for the value.  This will be implemented when we implement the ability to have control over both the value and label for drop downs, check boxes, and radio buttons.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Web Business Freedom on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-4353</link>
			<pubDate>Tue, 30 Mar 2010 10:50:12 +0000</pubDate>
			<dc:creator>Web Business Freedom</dc:creator>
			<guid isPermaLink="false">4353@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;This is how I anticipated having to fix it, but was worried that I would break any future updates to the plugin.&#60;/p&#62;
&#60;p&#62;Is there a hook or something else we can use to modify the submitted data instead of hacking the plugin?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>brianyerkes on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-3474</link>
			<pubDate>Thu, 18 Feb 2010 13:59:29 +0000</pubDate>
			<dc:creator>brianyerkes</dc:creator>
			<guid isPermaLink="false">3474@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Great stuff, worked perfectly! Thanks for your help, much appreciated!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>brianyerkes on "Abbreviate City Fields"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/abbreviate-city-fields#post-3473</link>
			<pubDate>Thu, 18 Feb 2010 13:40:34 +0000</pubDate>
			<dc:creator>brianyerkes</dc:creator>
			<guid isPermaLink="false">3473@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Sorry Carl, yes, I meant &#34;State&#34; fields, not city fields. Oops....I guess that was the Irishman living in America talking for a minute!&#60;/p&#62;
&#60;p&#62;Newport, awesome, I'm going to try that now.&#60;/p&#62;
&#60;p&#62;Thanks very much!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
