State Select

Print a select dropdown of US states.

To edit the list of states that are used, see Locales Config.

Table of Contents

Parameters

abbrev_label

Use the state's abbreviation for the option label. Defaults to no.

abbrev_label="no"
abbrev_value

Use the state's abbreviation for the option value. Defaults to yes.

abbrev_value="yes"
selected

The selected customer state.

selected="{customer_state}"
name

Set the form input name, i.e. gateway. if not set, defaults to "expiration_year"

name="state"
extra

Any extra tag data you'd like to add.

extra='rel="my_attr" title="my title"'
id

CSS id of your form. This is an arbitrary value.

id=""
class

CSS class of your form. This is an arbitrary value.

class=""

onchange

Optional javascript function to run when the select changes.

onchange="your_custom_javascript()"

add_blank

Adds a blank "--" value to the dropdown.

add_blank="yes"

Examples

{exp:cartthrob:state_select name="state" selected="{customer_state}"}