• Resolved inj9nhs3fhpabx4

    (@inj9nhs3fhpabx4)


    I want to show a drop-down list of countries and select their states from another drop-down list.

    I created a group of “Country” listing 100 country names
    [select* Country “A” “B” ….. “Z”]

    But I have the state info for only 2 of these 100 countries, specifically country “A” and “B”.

    So I created a group “A-states” list for country “A”
    and created a group of “B-states” list for country “B”

    In the conditions, I have added

    If Country equal to value=A, then show A-states
    If Country equal to value=B, then show B-states

    The form shows the states correctly if I select country A or B

    What do I need to add in the form and in the conditional field to allow user to type in the state for the other 98 country besides “A” or “B”?

    I added another group
    [group state]
    [text state]
    [/group]

    I tried using condition
    If Country not equal to value=A, then show states
    If Country not equal to value=B, then show states

    But the form is showing incorrectly.

    Any help is most appreciated.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    you would need to nest 2 groups:

    [group state-1]
    [group state-2]
    [text state]
    [/group]
    [/group]

    Then the conditions should be:

    If Country not equal to value=A, then show states-1
    If Country not equal to value=B, then show states-2

    I’m working on a more elegant way to add AND conditions. Stay tuned for updates.

    Thread Starter inj9nhs3fhpabx4

    (@inj9nhs3fhpabx4)

    I tried your suggestion but am still missing key info to make it work. Am new at this, so appreciate your patience.

    The goal for selecting or typing the state for a country:
    If an user selects the countries drop-down list either USA or Canada, then they should be asked to select from another drop-down list of the states of each of the these two countries. If the user selects any country other than USA and Canada, then the user should be able to type in the name of their state. In all cases, the state is saved in the same field in the database.

    Can you please help with the nested groups and conditions for the following?

    <label> Country (required)</label>
    [select* Country “Afghanistan” “Albania” “Canada” “USA” “Zimbabwe”]

    <label> State </label>

    [group Canada]
    <label> State (required)</label>
    [select* Canada-states “a” “b” “c” “d”]
    [/group]

    [group USA]
    <label> State (required)</label>
    [select* USA-states “w” “x” “y” “z”]
    [/group]

    [Group state]
    [/group]
    [text state]

    Thanks in advance for your help.

    Plugin Author Jules Colle

    (@jules-colle)

    Try this

    [select* Country “Afghanistan” “Albania” “Canada” “USA” “Zimbabwe”]
    
    [group Canada]
    <label> State (required)</label>
    [select* Canada-states “a” “b” “c” “d”]
    [/group]
    
    [group USA]
    <label> State (required)</label>
    [select* USA-states “w” “x” “y” “z”]
    [/group]
    
    [group state-1][group state-2]
    [text state]
    [/group][/group]

    Conditions:

    if [Country] equals "Canada" then show [Canada]
    if [Country] equals "USA" then show [USA]
    if [Country] not equals "Canada" then show [state-1]
    if [Country] not equals "USA" then show [state-2]
    Thread Starter inj9nhs3fhpabx4

    (@inj9nhs3fhpabx4)

    Can you please provide an explicit example with detailed instructions for beginners?
    Use case:
    1: select a country from a drop-down list
    2. Select state from drop-down list if a specific country’s states are known.
    3. Type in the state if specific country’s states are unknown.

    Plugin Author Jules Colle

    (@jules-colle)

    no it’s the names of the nested groups. there are arbitrary. call them floopsie and twoopsie if you like like this:

    [group floopsie][group twoopsie]
    [text state]
    [/group][/group]

    don’t forget to update your conditions though:

    if [Country] not equals "Canada" then show [floopsie]
    if [Country] not equals "USA" then show [twoopsie]
    Thread Starter inj9nhs3fhpabx4

    (@inj9nhs3fhpabx4)

    Thanks…the display is still incorrect. I am obviously doing something wrong. Please see below:

    <label> Country (required)
    </label>
    [text Country]
    [select* Country “Afghanistan” “Albania” “Canada” “USA” “Zimbabwe”]
    
    [group Canada]
    <label> State (required)</label>
    [select* Canada-states “a” “b” “c” “d”]
    [/group]
    
    [group USA]
    <label> State (required)</label>
    [select* USA-states “w” “x” “y” “z”]
    [/group]
    
    [group state-1][group state-2]
    [text state]
    [/group][/group]

    The conditions used:

    if [Country] equals "Canada" then show [Canada]
    if [Country] equals "USA" then show [USA]
    if [Country] not equals "Canada" then show [state-1]
    if [Country] not equals "USA" then show [state-2]

    Note I had to add [text Country] or Country does not appear as a option for the ‘if’ part of condition. As a result I now see two Country input boxes, but no drop-downs in either. Thanks so much for your patience.

    Plugin Author Jules Colle

    (@jules-colle)

    You have 2 fields named Country. Please rename your text field to Country-text or something.

    So you got:

    [text Country-text]
    [select* Country “Afghanistan” “Albania” “Canada” “USA” “Zimbabwe”]
    Plugin Author Jules Colle

    (@jules-colle)

    also, but this mighth be a copy paste issue. You need to use quites like this "

    en not like this or this

    • This reply was modified 6 years, 5 months ago by Jules Colle.
    Thread Starter inj9nhs3fhpabx4

    (@inj9nhs3fhpabx4)

    Changed the quotes. Working perfectly now. Thanks for all your help ??
    For others who may find this useful, here’s the final version:

    <label> Country (required)
    </label>
    [select* Country "Afghanistan" "Albania" "Canada" "USA" "Zimbabwe"]
    
    [group Canada]
    <label> State (required)</label>
    [select* Canada-states "a" "b" "c" "d"]
    [/group]
    
    [group USA]
    <label> State (required)</label>
    [select* USA-states "w" "x" "y" "z"]
    [/group]
    
    [group state-1][group state-2]
    <label> State (required)</label>
    [text state]
    [/group][/group]
    Plugin Author Jules Colle

    (@jules-colle)

    No problem! Feel free to leave a review ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Conditional field NOT equal to multiple values’ is closed to new replies.