3

I have a content type that has a taxonomy field with two options. If Option A is selected, I want a further taxonomy field with items from Taxonomy X. If Option B is selected, I want another taxonomy field, but with items from Taxonomy Y.

In Drupal 6 I used Conditional Fields, which was great. However, there exists no stable D7 version yet, and I need this functionality for a project due this week. The project page even says: "Drupal 7 version (3.x): 7.x-3.x is currently in development. It is a complete rewrite of the module that leverages the new entities system and the States API. Not ready for use on production sites yet." So I feel like I'd be really dumb if I put this on a production site and something broke, when the module project page itself specifically tells me not to.

The other option seems to be Field Conditional State, but that's used on a total of 274 sites (compared to the ~18,000 of Conditional Fields).

  1. Are there any other D7-compatible modules that allow forking of field display based on the value of another field?
  2. If not, how stable is Field Conditional State?
  3. Should I just suck it up and write a module that does what I'm wanting?

Many thanks.

  • 2
    I have used Field conditional on multiple sites, and didnt face any problems with it. My advice is to go for it, Totally not worth creating one from scratch. – saadlulu Oct 31 '12 at 12:12
  • @saadlulu -- I wouldn't write a new Conditional Fields module; I'd just write something that hooks into the node creation form and sets state elements on those particular fields. It wouldn't be a ton of work. That said, I've already changed my mind on the implementation and have just built two different content types instead. However, I'm still really curious if there's a production-ready conditional fields module for Drupal 7. – aendrew Oct 31 '12 at 13:39
  • I agree with saadlulu. I have used Conditional Fields module on several sites and it works well. If you have the skills to build your own module, then why not help conditional fields get to a stable state instead of running off and reinventing the wheel? – user842 Oct 31 '12 at 15:26
  • @nicoz -- See my previous response to saadlulu, I'm not wanting to reinvent the wheel but can hook into Field API and tweak the #state of a field if I need to. That is a good point, though -- it's a useful and simple enough module that I could probably be helpful there if I chose to do so (Alas, time is something I'm perennially short on). – aendrew Oct 31 '12 at 15:45
  • Also -- some of us do Drupal for a living and use dev modules with great trepidation. Giving my question -1 because I'm wondering how stable a dev-only module is annoys me somewhat. It's a very legitimate question. – aendrew Oct 31 '12 at 15:50
4

Against my better judgement, I've used Conditional Fields to control field display. I'll post back here if I have any issues.

To anyone who arrives at this answer from Google, I made at my decision after looking at the module's usage stats, which paints it almost at parity with the stable D6 version:

Conditional Fields usage stats.

It's worth checking out http://drupal.org/node/1551504, which is intended to spur a D7 stable release (The author looks a bit overwhelmed by it all, truth to be told.). I've closed any similar questions and pointed them to that, which seems to have the most traffic.

That all said, it's kinda hard to contribute to a project when the maintainer is MIA...

  • 1
    Actually, there is a somewhat standard process for abandoned projects, drupal.org/node/251466. I will typically post patches anyway with the hope that someone will find them useful, even if they need to apply them manually. Drush make also makes it easier to apply patches from the issue queue that haven't been committed yet. – mpdonadio Nov 12 '12 at 17:40
  • I don't think the project is quite at the "Unsupported" stage yet, but if there's not a stable available by the time the list at drupal.org/node/1551504 is complete, I may consider reporting it as such. Also: Wait wait wait... Drush can apply patches?! – aendrew Nov 12 '12 at 17:51
  • 1
    drupal.org/project/drush_iq can apply patches, and you can also specify them in drush makefiles. – mpdonadio Nov 12 '12 at 18:00
  • Conditional fields in Drupal 6 became a administration nightmare. I hope you have better luck with 7. – Andrew Welch Aug 19 '13 at 12:52
  • Worth noting there is now a recommended release for Conditional Fields on D7. – aendrew Jan 1 '14 at 1:26
2

My personal current assessment of this is that there are still 3 main options:

I have used conditional fields a lot over a number of years and I find myself more and more frustrated with the number of bugs in it, especially if you have more than basic requirements.

That combined with the lack of movement in the issue queue means I no longer use it on new projects.

That is by no means a jab at the maintainers, I completely understand how hard it is to make time to do unpaid work maintaining Drupal modules, that is just how it is currently in this case.

So I currently prefer the field conditional states module. The reasons for that are:

  • It is more actively maintained.
  • It is less buggy (at least from my experience).
  • From a technical point of view I prefer how it has been coded. It is simpler and relies more on the existing Drupal states API.

Where the Field Conditional States module has fallen down a little in the past has been its lack of support for different field types.
Support of different fields has greatly improved more recently though and I have found the maintainers have been quite fast to add support for fields on request (even without anyone providing a patch).

So I think that is less of an issue now but if you do have to support less common field types I recommend checking all the options to see whether any of them support those field types. That may make your decision a little easier.

I also think that custom code using the states API is a good solution in a lot of cases if you don't mind writing code. You can end up with a much simpler, more lightweight solution and can more easily handle complex scenarios.

  • Thanks for the update, answers like this are really helpful! – aendrew Aug 5 '15 at 10:03
0

conditional_fields works better in D7. compared to field-conditional-state. When I used field-conditional-state + Jquery update module It did n't work. Refer http://drupal.org/node/1720120

  • 1
    field-conditional-state works really well and the issue mentioned here is an issue that is resolved. – Duncanmoo Oct 16 '13 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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