/    Sign up×
Community /Pin to ProfileBookmark

Lost with combined options…

I’m trying to make the tipical form in which you choose a continent, then a country, etc… I would like to connect the two list, so if you choose a continent, then the proper countries are given. I can do it in PHP combined with a jump menu, but it will reload the whole page… It should be a way to reload only the options, like using ajax…
Any examples or hints?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJan 03.2008 — There are not enough different countries to make it efficient to download separate files by continent for a menu- I have a Countries object which has seven continent arrays. Choosing a continent in one menu fills the next with that member's array text and value.
Copy linkTweet thisAlerts:
@PerfidusauthorJan 03.2008 — The fact is that it was just an example, I'm working with "Provincias" which is the political division for Spain, and each "provincia" has a hundred towns or more, so the javascript must contact a PHP to check a database and return the results. My explanation wasn't any good but I'm currently fuc&%$ with a flu... Sorry. My brain feels like s%&$"...
Copy linkTweet thisAlerts:
@mrhooJan 03.2008 — You can use ajax to call a php script with a GET that specifies the search,

something like-

[CODE]function getCityList(str){
ajax= // xmlHttpRequest object
var url= "getcities.php"+"?q="+str; // add a tail to the php page
ajax.onreadystatechange= // the function that fills the city menu from the response text
ajax.open("GET",url,true)
ajax.send(null)
}[/CODE]
Copy linkTweet thisAlerts:
@PerfidusauthorJan 03.2008 — That sounds exactly as the thing I need, I'm trying to write the function for filling the new list, but I'm not really good at javascript, some hints will be very wellcome !! ?
Copy linkTweet thisAlerts:
@ZeroKilledJan 04.2008 — this sound like a recent thread concerning to fill a select box with retrieved option from ajax response. follow the link http://www.webdeveloper.com/forum/showthread.php?t=169658
×

Success!

Help @Perfidus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...