How can I limit the user's choice of States in address field?

  • sommerville88
    Asked on March 24, 2018 at 4:37 PM

    I only want to allow certain states in address field. either by limiting choices or by checking values entered. what's a good way to do this?

  • Adrian
    Replied on March 24, 2018 at 5:24 PM

    If you want to limit the State Choices to the American States, you can do so by enabling that option in the Properties of the Address field.

    How can I limit the users choice of States in address field? Image 10

    If you want to limit the State Choices to certain States, then you can add a Dropdown element from the list of elements and set the State options there. It is not possible to set certain State choices in the Address field.

  • Adrian
    Replied on March 24, 2018 at 6:01 PM

    If you set the State Options to "American States", then it is possible to HIDE certain states using Custom CSS.

    DEMO: https://form.jotform.com/80826643659973

    On this demo form, I have hidden Alabama and Alaska using this custom CSS code.

    #input_3_state option:nth-child(2),
    #input_3_state option:nth-child(3) {
      display: none;
    }

    Notice the CSS selectors there. The 2nd and the 3rd option will hide. You can add as many lines of CSS separated by a comma. If you want to hide the 11th option (Florida), the CSS code would look like this.

    #input_3_state option:nth-child(2),
    #input_3_state option:nth-child(3),
    #input_3_state option:nth-child(11) {
      display: none;
    }