Welcome, Guest

TOPIC: Town / County / Country

Town / County / Country 2 years ago #13502

I have three tables constructed as follows

countries

countryid / country

counties

countyid / countryid (as defined by countries table) / county

towns

townid / countyid (as defined by county table) / town

All the data is in place for the entire of the UK, now I just want to intergrate this into Breezing Forms. I can do single table dynamic select boxes with information taken from the database, but I want to link all three so that

1) Use chooses a country, and county box is populated from counties table, filtered by the selected country

2) Use chooses a county, and town box is populated from towns table, filtered by the selected county

In other words, a pretty standard thing these days in most forms, but I was wondering if anyone knew how to do it using breezing forms,

Thanks in advance for any replies
  • leecymj
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0

Re: Town / County / Country 1 year, 12 months ago #13719

Did you discover how to do this?

I would appreciated any suggestion on where to find a solution for this!

Thx ~ debi

Re: Town / County / Country 1 year, 11 months ago #13757

me too
  • l.grube
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Karma: 0
Laurent GRUBE

Re: Town / County / Country 1 year, 9 months ago #15399

Hi guys,
I'm not a developer, but I managed to make it working a form with something similar. you select a region, than a country ad if there is the option you select a state
there is field "Region" with id: "CselRegion"
there is field "Country" with id: "CselCountry"
there is field "Province or State" with id: "CselState"

this is the action script for Region:

function ff_CselRegion_action(element, action)
{
country = ff_getElementByName('CselCountry');
state = ff_getElementByName('CselState');

if (element.value == 'none') {
// drop countries
while (country.options.length > 0)
country.options[country.options.length-1] = null;
} else {
// get the matching array
var selectedArray = eval(element.value+'Array');

// drop supernumerous option
while (selectedArray.length < country.options.length-1)
country.options[country.options.length-1] = null;

// add the new options
country.options[0] = new Option('Select Country', 'none', true, true);
for (var i=0; i < selectedArray.length; i++)
country.options[i+1] =
new Option(selectedArray[i], selectedArray[i]);
} // if

// drop states
while (state.options.length > 0)
state.options[state.options.length-1] = null;
} // ff_CselRegion_action

this is the action script for Country:

function ff_CselRegion_action(element, action)
{
country = ff_getElementByName('CselCountry');
state = ff_getElementByName('CselState');

var africaArray = new Array(
'Ethiopia', 'Somalia', 'South Africa', 'Other'
);

var middleeastArray = new Array(
'Egypt', 'Iran', 'Israel', 'Kuwait', 'Lebanon', 'Morocco',
'Saudi Arabia', 'Syria', 'Turkey', 'U.A.Emirates', 'Other'
);

var asiaArray = new Array(
'Armenia', 'Bangladesh', 'Cambodia', 'China', 'India', 'Indonesia',
'Japan', 'Malaysia', 'Myanmar', 'Nepal', 'Pakistan', 'Philippines',
'Singapore', 'South Korea', 'Sri Lanka', 'Taiwan', 'Thailand',
'Uzbekistan', 'Vietnam', 'Other'
);

var europeArray = new Array(
'Albania', 'Austria', 'Belarus', 'Belgium', 'Bosnia', 'Bulgaria',
'Croatia', 'Cyprus', 'Czech Rep.', 'Denmark', 'Estonia', 'Finland',
'France', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland',
'Italy', 'Latvia', 'Liechtenstein', 'Lithuania', 'Luxembourg',
'Macedonia', 'Malta', 'Monaco', 'Netherlands', 'Norway', 'Poland',
'Portugal', 'Romania', 'Russia', 'Slovakia', 'Slovenia', 'Spain',
'Sweden', 'Switzerland', 'Ukraine', 'United Kingdom', 'Other'
);

var australiaArray = new Array('Australia', 'New Zealand', 'Other');

var lamericaArray = new Array(
'Costa Rica', 'Cuba', 'El Salvador', 'Guatemala', 'Haiti', 'Jamaica',
'Panama', 'Other'
);

var namericaArray = new Array('Canada', 'USA', 'Greenland', 'Mexico');

var samericaArray = new Array(
'Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador',
'Paraguay', 'Peru', 'Suriname', 'Uruguay', 'Venezuela', 'Other'
);

if (element.value == 'none') {
// drop countries
while (country.options.length > 0)
country.options[country.options.length-1] = null;
} else {
// get the matching array
var selectedArray = eval(element.value+'Array');

// drop supernumerous option
while (selectedArray.length < country.options.length-1)
country.options[country.options.length-1] = null;

// add the new options
country.options[0] = new Option('Select Country', 'none', true, true);
for (var i=0; i < selectedArray.length; i++)
country.options[i+1] =
new Option(selectedArray[i], selectedArray[i]);
} // if

// drop states
while (state.options.length > 0)
state.options[state.options.length-1] = null;
} // ff_CselRegion_action
function ff_CselCountry_action(element, action)
{
state = ff_getElementByName('CselState');

var stateArrayUSA = new Array(
'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado',
'Connecticut', 'Delaware', 'Columbia', 'Florida', 'Georgia', 'Hawaii',
'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky',
'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan',
'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska',
'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York',
'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon',
'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota',
'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington',
'West Virginia', 'Wisconsin', 'Wyoming'
);

var stateArrayGreenland = new Array(
'Avannaa (North)', 'Kitaa (West)', 'Tunu (East)'
);

var stateArrayMexico = new Array(
'(North)', '(West)', '(East)', '(South)'
);

var stateArrayCanada = new Array(
'Alberta', 'British Columbia', 'Manitoba',
'New Brunswick', 'Newfoundland and Labrador', 'Nova Scotia',
'Northwest Territories', 'Nunavut', 'Ontario', 'Prince Edward Island',
'Québec', 'Saskatchewan', 'Yukon'
);

var selectedArray = eval('stateArray'+element.value);



if (selectedArray == null) {
while (state.options.length > 0)
state.options[(state.options.length - 1)] = null;
} else {
// drop supernumerous option
while (selectedArray.length < state.options.length-1)
state.options[state.options.length-1] = null;

// add the new options
state.options[0] = new Option('Select State', 'none', true, true);
for (var i=0; i < selectedArray.length; i++)
state.options[i+1] = new Option(selectedArray[i], selectedArray[i]);
} // if
} //ff_CselCountry_action


that's work with my form, hope it helps
take care

File Attachment:

File Name: trailform_pak_07_08_2010.zip
File Size: 34646
  • giorgio25b
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Last Edit: 1 year, 9 months ago by giorgio25b. Reason: I've changed the attachment file

Re: Town / County / Country 1 year, 8 months ago #16784

do you still need help?

matthias
  • goshmac
  • OFFLINE
  • Expert Boarder
  • Posts: 113
  • Karma: 5

(SOLVED, this part) Re: Town / County / Country 1 year, 4 months ago #23296

Hello Giorgio.

i'm working on something similar and cgrashed on a problem. Maybe you or someone else has the solution.

I built a set of SelectLists in a similar sequence as "Region"->"Country" (I eliminated "State" because I don't need it). The problem I have is that I want the last SelectList to be "Multiple" not single selections, but when i marc on the "Country" selectlist as YES to Multiple, when I view the form on the browser this selectlist only shows the default value "Select a Country" and it doesn't pull down. I assume I have to change someting in the Action Script of the "Region" SelectList but I don't know how. ¿Any idea?
Thanks.

This is the part of the adapted Script I believe has to be changed:

........................
if (element.value == 'none') {
// drop Tiposervicios
while (Tiposervicios.options.length > 0)
Tiposervicios.options[Tiposervicios.options.length-1] = null;
} else {
// get the matching array
var selectedArray = eval(element.value+'Array');

// drop supernumerous option
while (selectedArray.length < Tiposervicios.options.length-1)
Tiposervicios.options[Tiposervicios.options.length-1] = null;

// add the new options
Tiposervicios.options[0] = new Option('Elija uno o más', 'none', true, true);
for (var i=0; i < selectedArray.length; i++)
Tiposervicios.options[i+1] =
new Option(selectedArray[i], selectedArray[i]);
}
} // ff_CselAreaserv_action
  • Richper
  • OFFLINE
  • Senior Boarder
  • Posts: 41
  • Karma: 1
Last Edit: 1 year, 4 months ago by Richper. Reason: This problem was solved
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.53 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint