Select or other currently uses custom javascript to show/hide the 'other' field. Core's form states API should be able to handle this.

A rudimentary, but incomplete patch has already been submitted in https://www.drupal.org/node/2481127#comment-9909759. Let's finish the work we started.

Comments

DanChadwick’s picture

There is a comment in the related issue about using the workaround from comment #4 of #1149078: States API doesn't work with multiple select fields. I am pretty sure this would be a bad idea because it may well conflict with core if/when it ever gets fixed in core. I think that code would be fine in a custom module, but it seems risky for a contrib module.

legolasbo’s picture

I was thinking something like adding the workaround with a warning and a setting to enable/disable it if need be. That way any conflicts with core or contrib code exists, it can be disabled at the risk of broken multi-select boxes.

Fixing the underlaying core issue would be better tho.

DanChadwick’s picture

Your module, but that's a lot of risk when you have a 100% functioning solution now.

There seems to be a little activity in the core issue. If we test it, maybe it will get committed. You can then put a version dependency on core into your .info file. I think it is safe to depend upon a version when it is core.

legolasbo’s picture

Perhaps we can work together on landing the core issue and then fix this issue?

daften’s picture

Component: Forms API (Developers) » Field widget (non-specific or listed)
Status: Active » Closed (outdated)

Closing as outdated because no activity in a long time and Drupal 7 goes EOL soon. Feel free to re-open if needed.