I need some guidance in the below scenario, please
- I make a table with a country name column and city name column
- User selects a country as a lookup field in the second table form (eg. select Australia)
- Then the below field "city" should only show cities in Australia as a dropdown.
How can I do this?
Can't use advanced lookup field SQL query since the record is still not entered to the database.
A little help, please.....
Lookup Field Advance Customization help
-
- AppGini Super Hero
- Posts: 121
- Joined: 2020-02-16 16:29
-
- AppGini Super Hero
- Posts: 121
- Joined: 2020-02-16 16:29
Re: Lookup Field Advance Customization help
Courtesy of pböttcher
Re: Lookup Field Advance Customization help
(1)
Did you setup the tables and lookups correctly? Like this:
Countries
-id
-name
Cities
-id
-country_id (lookup cities name)
-name
If cities.country_id is a lookup to countries, the dependent dropdowns should work as expected.
(2)
You have to fill countries table first.
Then start filling cities table. On a new record in cities dv you can select a country from the dropdown.
(3)
Using data in a third table
Addresses
-id
-country_id (lookup countries name)
-city_id (lookup cities name, filter by country_id )
-street
-...
If setup according to (1) and (2) is correct, there will be a checkbox "filter by country_id" when editing city_id field.
Whever you create a new address, after selecting a country, there will be cities related to the chosen country in cities-dropdown, only.
Did you setup the tables and lookups correctly? Like this:
Countries
-id
-name
Cities
-id
-country_id (lookup cities name)
-name
If cities.country_id is a lookup to countries, the dependent dropdowns should work as expected.
(2)
You have to fill countries table first.
Then start filling cities table. On a new record in cities dv you can select a country from the dropdown.
(3)
Using data in a third table
Addresses
-id
-country_id (lookup countries name)
-city_id (lookup cities name, filter by country_id )
-street
-...
If setup according to (1) and (2) is correct, there will be a checkbox "filter by country_id" when editing city_id field.
Whever you create a new address, after selecting a country, there will be cities related to the chosen country in cities-dropdown, only.
Last edited by jsetzer on 2020-11-27 07:27, edited 1 time in total.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Lookup Field Advance Customization help
PS: I have seen that you have found the solution in the meantime while I was writing an answer.
Anyway, I hope my answer will help others configuring dependent lookups in the future.
PPS: please don't double post + email the same question
Anyway, I hope my answer will help others configuring dependent lookups in the future.
PPS: please don't double post + email the same question
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
-
- AppGini Super Hero
- Posts: 121
- Joined: 2020-02-16 16:29
Re: Lookup Field Advance Customization help
Thanks for the descriptive answerjsetzer wrote: ↑2020-11-27 07:22(1)
Did you setup the tables and lookups correctly? Like this:
Countries
-id
-name
Cities
-id
-country_id (lookup cities name)
-name
If cities.country_id is a lookup to countries, the dependent dropdowns should work as expected.
(2)
You have to fill countries table first.
Then start filling cities table. On a new record in cities dv you can select a country from the dropdown.
(3)
Using data in a third table
Addresses
-id
-country_id (lookup countries name)
-city_id (lookup cities name, filter by country_id )
-street
-...
If setup according to (1) and (2) is correct, there will be a checkbox "filter by country_id" when editing city_id field.
Whever you create a new address, after selecting a country, there will be cities related to the chosen country in cities-dropdown, only.