Jump to main content Jump to doc navigation

What is FormItStateOptions?

FormItStateOptions is an assistance snippet for FormIt 1.7.0+ that will output an option list of U.S. states. It is useful for forms that need a dropdown list of U.S. states.


Simply add the Snippet to your form, in a <select> call:

<select name="state">
[[!FormItStateOptions? &selected=`[[!+fi.state]]`]]

Note how we are passing the value of the "fi.state" placeholder (which stores the value of the state field) into the selected parameter. This tells FormItStateOptions to select the last-selected option in the form.

FormItStateOptions Properties

FormItStateOptions comes with some default properties you can override. They are:

Name Description Default
selected The country value to select.
selectedAttribute Optional. The HTML attribute to add to a selected country. selected="selected"
tpl Optional. The chunk to use for each country dropdown option.
useAbbr If 1, will use the state abbreviation for the value. If 0, will use the full state name. 1
toPlaceholder Optional. Use this to set the output to a placeholder instead of outputting directly.

See Also

  1. FormIt.Hooks
    1. FormIt.Hooks.email
    2. FormIt.Hooks.FormItAutoResponder
    3. FormIt.Hooks.math
    4. FormIt.Hooks.recaptcha
    5. FormIt.Hooks.redirect
    6. FormIt.Hooks.spam
    7. FormIt.Hooks.FormItSaveForm
  2. FormIt.Validators
  3. FormIt.FormItRetriever
  4. FormIt.Tutorials and Examples
    1. FormIt.Examples.Custom Hook
    2. FormIt.Examples.Simple Contact Page
    3. FormIt.Handling Selects, Checkboxes and Radios
    4. FormIt.Using a Blank NoSpam Field
  5. FormIt.FormItCountryOptions
  6. FormIt.FormItStateOptions

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.


  • modmore
  • modmore
  • Jens Wittmann – Gestaltung & Entwicklung
  • Raffy
  • eydolan
  • Digital Penguin
  • Fabian Christen
  • Dannevang Digital
  • deJaya
  • Sepia River Studios
  • Following Sea
  • Anton Tarasov
  • Lefthandmedia
  • Nick Clark
  • Chris Fickling
  • Murray Wood
  • YJ
  • CrewMark
  • Richard


$305 per month—let's make that $500!

Learn more