views:

44

answers:

2

Hi guys!

Firstly, I am sorry, i just can't seem to phrase my question well.

Setup: I am using Drupal to build this location-based application.

i have a form which allows the user to select his/her location. the form has 3 'dependent' select elements e.g. country, city, state. they are dependent in such a way, that selecting a particular state [in the state select] will filter the choices which get displayed in city select, and so on.

I am trying to do this using Jquery, but i can't seem to make it work.

I know that my issue is very trivial for you out there expert in this kind of thing, but I'm not, therefore I am asking for your assistance.

Thank you very much!

A: 

Based on your comment above, I'd recommend looking into Drupal's AHAH components, which are described in detail at http://drupal.org/node/348475. The situation you're describing is precisely what AHAH was built for, and it will save you the trouble of mucking around in Javascript to manage Drupal logic.

That said, if you're not willing to go back and re-do your application using AHAH, the drupal_json() function should address the problem you described in your comment. drupal_json basically says "return a json object instead of a drupal page".

anschauung
thank you very much... the problem was fixed already... i appreciate your help... :)
ultrajohn
thanks, the problem was solved already. :)
ultrajohn
A: 

Why use jQuery when you can use a module in Drupal that allows you build dependent select elements?

Check out http://drupal.org/project/hierarchical_select

Sid NoParrots
thanks for your suggestion! :)
ultrajohn