What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to do dynamic dropdowns e.g. county field based on state field using 2 columns/fields only

    Asked by gorlando on January 30, 2013 at 12:40 PM

    is there any way to do the following?

     

    i want to have, for example, 3 fields in my jotform.

     

    U.S. State

    County

    for sale item

     

    i want to use drop downs for state and county.

    my problem is that i don't want to have 50 jotforms,

    one for each state

    is there a way to programmatically have the user choose

    the state and dynamically populate the county list depending on the state?

    so that the spreadsheet will have only 3 columns?

    as opposed to having hidden state fields in jotform,

    which i assume would populate the spreadsheet

    with 50 columns and would be difficult to manage anyway.

    dynamic dropdown multi-dropdown
  • Profile Image
    JotForm Support

    Answered by EduardoMendez on January 30, 2013 at 02:47 PM

    Hi there, 

    Here is a form that has the State and County part of the problem solved.

    http://form.jotformpro.com/form/30295814929968?

    I added drop-down fields and applied conditional logic to show and hide these fields.

    http://www.jotform.com/help/57-Conditional-Logic-on-Forms

    You can clone the form in order to use it if you wish.  You woul simply need to apply the same idea on to the field that will be containing the products.

    http://www.jotform.com/help/42-How-to-clone-an-existing-form-from-a-URL

    I hope this helps!

  • Profile Image

    Answered by gorlando on January 30, 2013 at 03:02 PM

    that's really nice. thanks.

    but my problem is , as i suspected, that all the columns show

    in the google spreadsheet

    and i want to really only show

    one column for state and one column for county

    in the list view.

    like

    State   County

    Florida  pasco

    Arizona  countyname

    i will work with it but if you have any ideas let me know

  • Profile Image

    Answered by adamsmeat on January 30, 2013 at 04:45 PM

    Hi there,

    I'm currently vying for a spot in Support team and this is what I have as workaround at the moment.

    Previous hacks on this use case ends with the user having redundant fields/columns when you use the 'Conditionals' feature of JotForm. So here is my take using extra javascript.

     

    Here is the pastebin link so you can easily copy paste:

    http://pastebin.com/rK6syWjg

     

    Here is the quick view of a demo: http://jotform.paoloumali.com/jotform-dynamic-dropdown.html

    Note that it works only with States AL and CA as I provided options for them only.

     

    What I'm doing is this:

    1. Along with embedding the jotform script, I'm including jquery and some js code that does the dynamic functionality.

    2. I'm using the Special option for States wherein JotForm allows you to have state Abbreviations

    3. The javascript code will require you to add your JotForm dropdown options for your counties in a certain format as shown below:

    County1, AL

    County2, AL

    County1, CA

    County2, CA

     

    The state abbreviations are necessary for filtering the counties when state dropdown is changed.

    Since you will have your own form, please look closely at the code portion:

     

    var 

    jotform_id = "#30295750834457", //usually jotform id, needed to reference the iframe

    independent_id = '#input_3', //replace by the id of the master/depended on, state

    dependent_id = '#input_4' //replace by the id of the slave/dependent dropdown select, counties

    ;

     

    Replace them with the values relative to your own form.

     

    Let me know if you need further help.

  • Profile Image
    JotForm Support

    Answered by EduardoMendez on January 30, 2013 at 05:44 PM

    In addition to the excellent suggestion, 

    You may want to try the following approach:

    http://form.jotformpro.com/form/30296921309960?

    That form uses an "auto fill" field.  The user can select the State and then start typing the name of the county.  The field should help populate the value accordingly.

    The only down side to this is the accuracy as you do allow the user the option of enter a county from a different state.

    Hope that helps!

  • Profile Image

    Answered by gorlando on January 30, 2013 at 05:49 PM
    i think the support team should hire you immediately....
    i don't know where to put the javascript, so maybe you can help me with
    this form
    and i will try to incorporate it into my other 3 from that.
    http://form.jotform.us/form/30296406016145
  • Profile Image

    Answered by gorlando on January 30, 2013 at 05:50 PM
    brilliant. thanks
  • Profile Image

    Answered by gorlando on January 30, 2013 at 05:54 PM
    adamsmeat, i think i will use eduardos solution
    while not exact, it will work for my purposes
    both are brilliant.
    thanks
  • Profile Image

    Answered by exchangepress on April 09, 2015 at 02:33 PM

    The sample forms on this thread are listed as Over Quota and can't be viewed.

  • Profile Image
    JotForm Support

    Answered by Welvin on April 09, 2015 at 05:16 PM

    @exchangepress,

    It should be fixed now. Kindly check. But if not, I've cloned it for you. Here's the new link:

    http://www.jotformpro.com/form/50986582275973

    Thanks

  • Profile Image

    Answered by paul field  on June 10, 2016 at 12:00 PM

    can this be updated to add City after State and County?

     

    I have a database of these if you would like me to send it.

     

    Thanks

     

    Paul

     

    paulmfield AT gmail DOT com