How can I create a condition with the city field in Address?

  • Marco_Romano
    Domanda del 27 luglio 2024 alle ore 19:31

    Altra domanda sulle condizioni: devo selezionare anche la condizione della Residenza in cui se chi compila il modulo inserisce "Milano" ugualmente il pagamento va saltato. Il problema è che non ho l'opzione CITY da selezionare ma solamente STATE che tra le altre cose non appare nel modulo:
    Condizione impossibile saltare ultima pagina Image 1 Screenshot 30 Screenshot 10

    Condizione impossibile saltare ultima pagina Image 2 Screenshot 41 Screenshot 21

  • Ericson_B Jotform Support
    Risposta del 27 luglio 2024 alle ore 19:48

    Hi Marco,

    Unfortunately, you cannot create a condition that includes the city in an address field. As a workaround, we can use the Substring widget to acquire the city's value, which we will then use to set the condition. Let me show you how:

    First, we'll get the Field ID of the city from the address field.

    1. In Form Builder, select the form element’s gear icon to open properties.
    2. In the properties panel, go to Advanced at the top.
    3. Scroll down to the bottom and expand Field Details.
    4. Copy the value of the City in the Field ID.

    How can I create a condition with the city field in Address? Image 1 Screenshot 60 Then we'll add the substring widget and paste the field ID into it. 

    1. In Form Builder, click on the Add Form Element menu on the left side of the page.
    2. Under the Widgets tab, enter Substring in the search bar, and drag and drop the widget to your form.
    3. In the widget settings, enter the City's field ID.
    4. Then, enter 0 for the substring start and 5 for the substring end

    How can I create a condition with the city field in Address? Image 2 Screenshot 71 Check out the screencast below to see my result:

    How can I create a condition with the city field in Address? Image 3 Screenshot 82 Now we'll set up the condition so that if Milan is the City's value, the Payment field will be hidden or skipped. 

    1. Go to Settings at the top.
    2. Select Conditions on the left.
    3. Add a new Show/Hide Field condition.

    How can I create a condition with the city field in Address? Image 4 Screenshot 93In this demo form, the conditional logic is as follows:

    How can I create a condition with the city field in Address? Image 5 Screenshot 104Note to hide the Subsctring widget so that it is not displayed on your form. I only show it on my demo form so you can see how it works. 

    Give it a try and let us know if you have any other questions.