You are here

Conditional Fields vs AHAH Helper

I worked on a project in which node forms display text fields based on the values of other fields. For example, if a checkbox field is checked, the form should display a text field below. Another example would be if a user chooses the option "other" in a select box, a text field should be displayed as well. The first thing that came to my mind was AHAH, which I could easily use with the help of AHAH Helper module. After further research, I discovered the perfect solution to my problem: Conditional Fields. Conditional fields define dependencies between content type fields based on the state of their states and values. An example scenario would be a selection box of "Occupations". If the user did not see their occupation in the predefined list, a text box will be displayed so that they can enter the right information. Another good thing about using conditional fields is that it can be exported via features. You don't need to write code to do this and maintenance does not become a nightmare. In order to use conditional fields here is what you need to do:

  • enable the module
  • navigate to "admin/content/node-type/CONTENT_TYPE_NAME/fields/FIELD_NAME"
  • under "Controlling fields", select the choose the field's value that would be used to display current field

For more information regarding conditional fields, please visit the following links: http://drupal.org/project/conditional_fields http://drupal.org/node/475488

SHARE SOCIAL
Developer
Rexx joined Appnovation Developer Team in 2008. He is a clever guy who loves to solve business problems in the most simple and elegant way possible. He is driven and does whatever it takes to get the job done without sacrificing the quality of work.Bucket List Accomplishments: Spring Break in...→ More about Rexx
Developer

Rexx joined Appnovation Developer Team in 2008. He is a clever guy who loves to solve business problems in the most simple and elegant way possible. He is driven and does whatever it takes to get the job done without sacrificing the quality of work.

Bucket List Accomplishments: Spring Break in Cancun! We’ll save the story telling to Rexx.

Weekends are Spent: Playing basketball or at Gary Point and reading Manga...he says its geeky, we say classic!

Favourite Books: 1984 and The Metamorphosis

Appnovation Technologies