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

  • Profile Image
    sommerville88
    Asked on March 24, 2018 at 04: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?

  • Profile Image
    Adrian
    Answered on March 24, 2018 at 05: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.

    15219264611.png

    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.

  • Profile Image
    Adrian
    Answered on March 24, 2018 at 06: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;
    }