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 do I populate a hidden field with a specific value based on a users selection

    Asked by MyPartySupplies on October 20, 2016 at 01:55 PM

    Hi

     

    Let's say I have a list of cities:

    London

    Birmingham

    Liverpool

    Berlin

    Frankfurt

    and I would like to assign a 'region' to each of them and then populate a hidden field with a unique value based on the users selection.

    So I have 2 regions

    UK (1)

    Germany (2)

     

    Now whenever a user selects London, Birmingham or Liverpool I would like to populate a hidden "region" field with either "UK" or a numerical value (1)

    While if the user selects Berlin or Frankfurt I would like to populate the hidden "region" field with either "Germay" or a numerical value (2).

     

    Essentially this consists of two tables with N entries where values in table 1 (Cities) match a corresponding value in table 2 (Regions)

    How can I achieve this with Jotform?

     

    Thanks in advance

    hidden Selection how a
  • Profile Image
    JotForm Support

    Answered by Kiran on October 20, 2016 at 04:33 PM

    You may populate the hidden field with a value based on the selection of another field using a set of conditions

    Please see the conditions set on the demo form with the list of cities in a dropdown and the region is a text box field.

    You may hide the Region field on the form by selecting the Hide Field option from the field properties.

    Please see the demo form below and feel free to clone it to your account.

    https://form.jotform.com/62936072581965

    Hope this information helps! 

     

  • Profile Image

    Answered by MyPartySupplies on October 21, 2016 at 06:44 AM
    Thanks Kiran
    That works - but it could be very tedious if I have dozens (or hundreds) of
    cities and regions. Is there any way I can populate this in a more
    database-table like structure and then do a lookup from one to the other
    based on the value?
    i.e.
    *Cities*
    *Region_ID | Name*
    1 | London
    1 | Birmingham
    1| Newcastel
    2| Berlin
    2| Frankfurt
    etc
    and a Regions table like
    *Regions*
    *Region_ID | Region_Name*
    1 | UK
    2 | Germany
    3 | France
    4 | other
    etc
    and then do a lookup (where London for example would return a Region_ID of
    1 which is mapped in the Regions table to "UK") - rather than a VERY long
    conditions statement?
    Please let me know - thanks in advance.
    Dieter
    ...
  • Profile Image
    JotForm Support

    Answered by Nik_C on October 21, 2016 at 07:28 AM

    Unfortunately, I don't see a way to that on a form itself. There is Matrix field for example, that you can use for a table, but, you can not use conditions to copy a value to it's fields, since you can not specify which data will go to certain field.

    I'm thinking that best way for you to manage that is to integrate your form with Spreadsheets and manage your data there:

    You will be able to search, review and to all necessary checkings right there.

    Could something like that work for you?

    Please let us know.

    Thank you!