My goal is to hide the field until certain value in another field is selected in the node edit form. Is there a way for achieve that?

  • Asking for modules/tutorials is off topic here. You can check the current issue with porting the Conditional Fields module to D8. – Shawn Conn Aug 16 '16 at 0:12

You have the Conditional Fields module that works very well in Drupal 7, unfortunately there is not a Drupal 8 version, you can check this issue to find out its progress. If you want you can test the dev version, but I don't know if it works.

Other module in dev is the Field States UI

Field States UI allows sites builders with minimal PHP/Dev skills to configure the Field States API. This lets you configure a field to for example hide if another field has a certain value or hasn't been filled. While doing it via PHP can be be more powerful the UI can be very handy and in some cases quicker.

In the other hand you can make use of the #states property.

EDIT: As the OP says in the comments there is another module named Field Formatter Condition that can be used for accomplish this task.

| improve this answer | |
  • Out of interest, would jQuery and css be a decent option instead of #states? – Niall Murphy Aug 17 '16 at 10:18
  • I noticed you added the "conditional fields" tag ... which is clearly dedicated to the same named "module". I would suggest you remove that tag again, to make the question look less like a D8-version of that specific module. What do you think? PS: of course the question would still be about ... conditional fields, right? – Pierre.Vriens Aug 17 '16 at 10:57
  • @Pierre.Vriens I made the edit, really is a little ambiguous, the question is about conditional fields or about the conditional field module? – Adrian Cid Almaguer Aug 17 '16 at 13:20
  • Good question Adrian, it "could" be either one, but if the question would use the conditional fields "tag", then as per the excerpt of that tag "I" would think it's about the module. However in that case, the question could be summarized as "What's the D8 equivalent of this D7 module?". And as you probably know: asking for "How does this D7 code look like in D8?" seems perfectly OK, while "How do I replace this D7 module in D8?" is not OK for some users on drupal.SE. Anyway, I saw you removed that tag again, which is also what I recommend. – Pierre.Vriens Aug 17 '16 at 13:26
  • 1
    On November 2019, I have tested Conditional Fields on a project of mine (Conditional Fields is the first module mentioned on the above answer). Although still marked as Alpha, the module seems stable enough for me. I have done several tests and it works fine, at least for the basic type of request when it comes to conditionals: hiding or showing a field based on checkbox or select list value. – Marcos Buarque Nov 18 '19 at 12:19

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