Remember the create password page of Drupal! While you are entering characters it tells you how strong your password is!

Now I want to have something like this in a list box but a bit different. I want to show an image and a text depend on the item which is selected in the list box! How can I do it? My first try was adding some code in help text of the field, but it doesn't work. What are your suggestions?

I can not use conditional field because I must add 60 conditions and it is illogical. Ao I need a programmatic way. The java script code and how to I make it dependent to two list boxes? I add a markup field to my content type but I don't know who to find which item is selected in the list box with ajax ind how to show an item depend on it.

1 Answer 1


You don't have to code for this. You can use Conditional Fields to achieve it.

You can then use "Manage Dependencies" section (alongside manage display) to set the dependencies:

enter image description here

Then you can see the different fields being enabled or disabled depending on the entered input:

List option "No" Result:

enter image description here

List option "Yes" Result:

enter image description here

  • 1
    I know about field conditional. but what I need to show is not a field! I want to show an some description and image as the result of choosing an item in a list box!
    – shekoufeh
    May 15, 2015 at 6:32
  • Just thoughts, you can use a non-editable text field with pre-filled text for description: stackoverflow.com/a/5418607/260665 in conjunction with Conditional fields. There should be something for image in the same way, otherwise, you can hook the view and modify it for image alone. May 15, 2015 at 7:12
  • in this way I should add 59 fields because I have 59 different images and text to show depend on the item which is selected from the listbox! in addition, it is a illogical way I ask for a programmatic approach.
    – shekoufeh
    May 18, 2015 at 3:50

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