PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Zip Code Formatting

  1. FOCUS_forms
    Member

    Is there any simple way to structure a field to accept U.S. zip codes whether they are standard 5-digit values, or in USPS "Zip+4" format. In browsers equipped with autofill capailtiies, when the user has populated his/her zipcode with the latter, if the zip field has been limited to 5 numbers (and assuming this field is required), the Submit button won't work until the user deletes the extra character. On the other hand, increasing the field maximum length to 10 characters (to include the hyphen separating the zipcode from the subsequent 4 characters, increases the odds that the user will enter an invalid zip code.

    Posted 13 years ago on Wednesday March 30, 2011 | Permalink
  2. This isn't a built in feature. I'm not sure how you could accomplish this, it may be possible with jQuery but i'n not 100% sure. Either way it's a customization so it's something you would have to implement via custom code (jQuery or using the gform_validation hook to write custom validation using PHP. The gform_validation hook is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_validation

    But you would need to know WordPress custom development and PHP in order to properly implement it.

    Posted 13 years ago on Wednesday March 30, 2011 | Permalink