Possible Duplicate:
Easiest method for conditional fields in a form

Essentially I have 2 select fields on a form:

EDIT: I should mention, this is an entirely custom form built with Form API, I'm not modifying a core/contrib form.

  • Type

    • Global
    • Regional
  • City

    • Any
    • London
    • New York
    • Paris
    • LA

If Type:Global is selected, then the City field is hidden and City:Any is selected.

If Type:Regional is selected, then City is revealed, City:London selected and City:Any hidden.

Is there a Drupal or Form API compliant method to achieve this or is it simply a case of loading a JS file with drupal_add_js and writing entirely custom JS?

If it's simply custom JS/JQuery no need to write it out for me, I can handle that, but I would like to try and stick to the standard and best practices if there are any for my problem.



1 Answer 1


You can solve this problem using AHAH on your Form API. The module AHAH Helper may be very useful for you... take a look there...

Not the answer you're looking for? Browse other questions tagged or ask your own question.