Hello everyone,
I'm building a real estate website and i'm stack on something that may seems simple to most of you but i can't figure out how to make it!
I just want to have 2 select lists
1) the first one will show all my state
2) the second all cities of states
Now, when the user select a state in the first select list, i want to list dynamicly on the second select list only cities that belong to the choosen state! I don't want to list all my cities!
Here is an example:
state A, B, C
cities A1, A2, A3
B1, B2, B3
C1, C2, C3
Now when i select state A in state select list i only want to display in the cities select list, cities A1, A2, A3 which belong to the state A
Do you have any idea to how i can make this ?
i've read in some posts that there is a way of doing this with taxonomy and wiew but that doesn't mean anything to me...
any help will be appreciated !
thanks in advance
__
Edited by WorldFallz - nothing to do with module development, moved to appropriate forum.
__
Sorry about this ! Now i get this ;)
Comments
Wrong Forum
Hi,
This forum is for folks who are extending Drupal's functionality by writing a custom module.
If you are simply asking how to configure Drupal or community provided modules (e.g. Views, Taxonomy), you should post your question in "Post Installation" :).
If its for node form use Taxonomies + content taxonomy CCK
Hi Assuming that might want to use the above function on a node form, Below are steps that you can use
Step 1
-------------
Create a vocabulary called States, and then create hierarchical terms in the vocabulary.
Once you have created your taxonomies should something like this
State A
-- CIty 1
-- City 2
State B
-- City 3
-- City 4
Once you have vocabulary set,
Step 2
------------
Download & Install CCK & Content Taxonomy
Step 3
-----------
Create appropriate fields for your node and select content taxonomy as field widget.
When you goto create node, you will see that content taxonomy automatically shows hierarchical select boxes showing states and cities.
-Ravi
Php code to return parent term ID for the second select list
Thanks Ravi for the quick answer and your help !
1)Well, i've follow the steps and for my first select list with states i can with settings display only the vocabulary terms which is what i wanted for this
2)Then still need help for the second select list which have to show only cities according to the selected state (in the first select list)
With settings i can display childs term of a parent that i setup manualy and this is static!
Now, what i need is a php code to return parent ID of my selected state and so my cities are going to be available on the cities select list!
I've tried this but seems to not be the way of doing it
Ideas on how to do this still welcome !
thanks in advance
funky2D
Hi, It's me again ! I can't
Hi,
It's me again ! I can't imagine that this litle thing look impossible to do and i'm lost on drupals tuto, api ...
Just wondering if this realy impossible to do or just nobody there to help !!!
thanks
funky2D
hierarchical select
Hi ,
I think i missed out on this module Hierarchical select . Hierarchical select will provide you with a widget in content taxonomy and you will be able to select states -> cities so forth in a hierarchical manner.
-Ravi
thanks
Hi Ravi,
I realy appreciate your help !
Yeah the Hierarchical Select is the right module i needed !
Well, i just wondering for a single small thing to do, i have to install a module !!!
thanks again !
funky2D
I was searching for doing
I was searching for doing this mission today and i am very happy to find it here.
Thanks a lot for your question and your answer.
I did what you say and it seems it is OK except one thing.
only the city is shown on create node content example, but i want the State - City combination.
I have no idea about doing this.