Skip to content

Instantly share code, notes, and snippets.

@loneaggie
Created August 2, 2012 13:32
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loneaggie/3237136 to your computer and use it in GitHub Desktop.
Save loneaggie/3237136 to your computer and use it in GitHub Desktop.
Contact Form 7 State Dropdown
[select* selectedState
"Alabama|AL" "Alaska|AK" "Arizona|AZ" "Arkansas|AR"
"California|CA" "Colorado|CO" "Connecticut|CT" "Delaware|DE"
"Washington DC|DC" "Florida|FL" "Georgia|GA" "Hawaii|HI"
"Idaho|ID" "Illinois|IL" "Indiana|IN" "Iowa|IA" "Kansas|KS"
"Kentucky|KY" "Louisiana|LA" "Maine|ME" "Maryland|MD"
"Massachusetts|MA" "Michigan|MI" "Minnesota|MN" "Mississippi|MS"
"Missouri|MO" "Montana|MT" "Nebraska|NE" "Nevada|NV"
"New Hampshire|NH" "New Jersey|NJ" "New Mexico|NM" "New York|NY"
"North Carolina|NC" "North Dakota|ND" "Ohio|OH" "Oklahoma|OK"
"Oregon|OR" "Pennslyvania|PA" "Rhode Island|RI"
"South Carolina|SC" "South Dakota|SD" "Tennessee|TN"
"Texas|TX" "Utah|UT" "Vermont|VT" "Virginia|VA" "Washington|WA"
"West Virginia|WV" "Wisconsin|WI" "Wyoming|WY"]
@thomasbennett
Copy link

HUGE help, although Pennsylvania is misspelled so watch out

@nickberens360
Copy link

Bless your heart.

@zietbukuel
Copy link

You can now do this with Listo:

http://contactform7.com/listo/

@Pixelworlds
Copy link

Thank you!

@andysowards
Copy link

Signed in just to say you saved the day today, thank you!

@flipty
Copy link

flipty commented Nov 2, 2017

You rock! Thank you!

@crmpicco
Copy link

This doesn't work as you would expect. Both the value and key of the option are the same. The state code is not used or shown anywhere.

@B1-0S
Copy link

B1-0S commented Mar 28, 2018

Thanks Man!

Copy link

ghost commented Jun 5, 2018

Thank you

@Hackinet
Copy link

Hackinet commented Oct 9, 2018

Thank you.

@Shizart
Copy link

Shizart commented May 2, 2019

Props.

@tanmoy-web
Copy link

Thanks

@zagarskas
Copy link

zagarskas commented Sep 16, 2022

the pipe separators seem to not work correctly anymore... went with this because the APIs we use require 2 digit codes for state

[select* your-state "AL" "AK" "AZ" "AR" "CA" "CO" "CT" "DE" "DC" "FL" "GA" "HI" "ID" "IL" "IN" "IA" "KS" "KY" "LA" "ME"  "MD" "MA" "MI" "MN" "MS" "MO" "MT" "NE" "NV" "NH" "NJ" "NM" "NY" "NC" "ND" "OH" "OK" "OR" "PA" "RI" "SC" "SD" "TN" "TX" "UT" "VT" "VA" "WA" "WV" "WI" "WY"]

@DanielBabcock
Copy link

Thanks!

@Hackinet
Copy link

Got a notification on email. I can't believe 11 years have passed.

@Gretchen5
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment