Looking for a little help please. I have the code for USA states.

I would like to know if anyone could direct me to the exact location to place this state code in api. As I am reading through Code I have found that more maybe required beside this?

Can anyone point me in the right direction for additional code needed and placement. I was looking in $W.Dropdown and possibly global section not sure this is the right section? Not sure if this is correct or where to go from here. Any help would be grateful. Forgive me for not knowing more it’s a tough learning curve for a newbee old man like me. :slight_smile:

In addition, If anyone in the community needs this please feel free to copy and paste.

Thank you in advance!

 {
    'Alabama': 'AL',
    'Alaska' : 'AK',
    'Arizona': 'AZ',
    'Arkansas': 'AR',
    'California': 'CA',
    'Colorado': 'CO',
    'Connecticut': 'CT',
    'Delaware': 'DE',
    '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',
    'Pennsylvania': 'PA',
    'Puerto Rico': 'PR',
    'Rhode Island': 'RI',
    'South Carolina': 'SC',
    'South Dakota': 'SD',
    'Tennessee': 'TN',
    'Texas': 'TX',
    'Utah': 'UT',
    'Vermont': 'VT',
    'Virgin Islands': 'VI',
    'Virginia': 'VA',
    'Washington': 'WA',
    'West Virginia': 'WV',
    'Wisconsin': 'WI',
    'Wyoming': 'WY'
  }

The Cascading Form example is just what you’re looking for.

Yisreal, thank you very much for your guidance. I did see that but was not sure if it could be transformed into a significantly smaller box like one you might find on ummm, lets say ebay for instance?

After reading several post pertaining to this same subject it doesn’t detail that folders have to be created in order to have this work properly. When someone with zero experience in this field of coding just seeing the code does us any good. I found this paragraph below in a post from Jeff. this raises additional questions.

" If you notice under the “Page code” drop down of the wix page, you have to go to the Public folder and setup a public.js folder for usStates. You need to copy that section of code into the public/usStates folder on the right, create a usStates.js file and then run the code."

This is where the example falls a bit short for me, how do you create a folder? I see a settings gear on the right for renaming the file. Also, you cannot copy and paste the code because you need a second window open for your actual website builder, tried copy and paste but no option to paste once you switch pages. I tried copy and paste with shift method and it also doesn’t work. It sure would be nice if they just gave you the option to incorporate this in a much less time consuming manner. When I click editor it stays in code page rather than adding it directly to my website that I am working on. There has to be a better way that I am missing?

You don’t necessarily need to use a file in the Public folder. It just provides the advantage of allowing you to use the same code in multiple pages.

For more information on the Public folder, and other folders, see the article Wix Code: Working with the Site Structure Sidebar .