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:

Appnovation Technologies