In my fictitious content type form, I have this select/radio question:
"Do you want the pie ingredients?"

If the user selects "Yes", then a block of text needs to show up
2 spoons of sugar
1 cup of milk
4 cups of flour

How do I do this without writing a module? Why can't I create a custom field of type label/text? I am already using the conditional fields module so I can make the visibility/hidden fields happen, but it only applies to a field. Is there a way to inject/embed my text into the form?

As far as I know, there is no way to create custom text within a form unless I write my own module, which I would rather not do!

3 Answers 3


You are on the right track:

  1. Create a new field in your content type of type "Long Text", call it something like Ingredients Text ("ingredients_text") for the machine name -- the text that will be within this field can change per node as you like.

  2. Then, go to your Dependencies tab in this content type.

  3. Click "Add new dependency" and choose your newly created Textfield as the "Dependent". Choose your select / radio button as the "Dependee". (Leave the other two settings as is.)

  4. Click "Add Dependency"

  5. You are in a new screen, take the defaults

  6. For Node View setting of the edit screen, try "Hide the dependent if the dependee is not viewable by the user and the dependency is not triggered".

  7. Now when you the user is in the node, he can choose the radio button and the new text field will appear!

You will need to play with the settings but this does work, I just set this up on a site for a client. Note, the options in step 6 may vary depending on your particular setup.

  • Thanks for the detailed steps. Ideally I do not want it to be a field input because then my pie ingredients get stored in the table. I just want some notice or message to show up for the user. I just added the extra condition of disabling the Long Text field which makes it so the user cannot edit or change the notice. Very clunky, but it works. Gotta love and hate Drupal ...!
    – user785179
    Feb 23, 2012 at 17:21
  • Ok glad that worked, you could also look at the Field Permissions module if you needed more fine grained "view it but not edit it" type thing but it sounds like you found a good solution for that issue. Feb 23, 2012 at 18:08

I would create two fields on the content type: the "Do you want the pie ingredients?" boolean field and a field containing the block of text.

I'm assuming from the question the block of text is going to be the same each time, if so you can add the text as the field's default value. This has the added bonus of allowing the user to edit the text displayed if needed.

  • I actually do not want the user to be able to edit my pie ingredient. It is just a static and fixed response. As posted above, I just "fixed" it by disabling the field. This way it becomes read-only and the user cannot change it. Too bad the pie ingredients field will get stored in the table every time the user submits my content type.
    – user785179
    Feb 23, 2012 at 17:23

It's tricky, but it is possible to create a template for your content type's form. It should be using your actual page.tpl.php code.

ex : page--node--add--contenttype.

Then, you can add the desired elements and move them around/toggle them with jQuery. However, if your form is complex, you will need to control it's rendering instead of using only render($page['content']).

This method does not involve any modules but you need to understand (or learn) how forms are rendered in templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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