Populate county field based on autocompleted cities field

aksmith

Member
Hello:
I have created a 'cities' list/table with all Minnesota cities and their counties (table fields: cityName, county).
I am trying to create a form where the county field automatically updates when the user enters the cityName.
I am using the databasejoin plugin to run autocomplete for the cityName - works great!
Not sure how/where I should join the county field (? list join - if so I am having trouble setting that up) - or whether I need a little js script.
Thank you very in advance for your help. The more I use Fabrik, the more humble I am becoming... :confused:
-Alan
 
Hmmm, interesting. I was about to say use a Cascading Dropdown (CDD), but that would usually be the other way round - you'd select a county from a join element, and have a CDD which then showed all the cities in that county. I don't think it would work the other way round, as there isn't a unique foreign key to use.

I think you may have to roll your own solution using our "user AJAX". Take a look at the user_ajax_example.php in the top level of the main component folder (./components/com_fabrik/user_ajax_example.php). It's a little daunting if you aren't experienced with JS and PHP, but it's really not that hard.

Have a read of the instructions in that file, and get back to us with any questions you have.

-- hugh
 
Hi,
I have the same problem with zip codes and cities.
I want to show the city after selecting the zip code.

I set up the following:

Table zip_lu
Elements id, zip_lu, city_id

Table cities_lu
Elements id, city

left join in list cities - id (table cities_lu) and city_id(table zip_lu)


Element databasejoin to zip_lu (Id, label: zip_lu)
Element cascadingdropdown to cities (Id, label: city), watch: zip_lu, key: city_id

I get always the error:

1054 Unknown column 'zip_lu' in 'where clause' SQL=SELECT DISTINCT(`asfab_cities_lu`.`id`) AS value, `asfab_cities_lu`.`cities`AS text FROM `asfab_cities_lu` AS `asfab_cities_lu` WHERE zip_lu IN ('') ORDER BY text ASC

Where is the mistake?

Thanks for any help

Kosta
 
We are in need of some funding.
More details.

Thank you.
Back
Top