The collapsable form box is labelled "conditions" but you can only set one of them. I want to show a field only if two other fields are empty. I think it can be done with rules but it seems like a basic case that the UI should cover.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dshields’s picture

Any movement on this? Anyone else need this functionality?
I think multiple conditions would be a huge advantage in some contexts.

mducharme’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
6.83 KB

Here's the initial implementation for review. I believe that I got all of the edge cases and bugs worked out. Looking for feedback on the UI and functionality. I believe that the "remove only" option for saved conditions makes sense. I also haven't touched the tests so those will likely need updating as well...

Up for discussion is the "and" operation for multiple conditions (default functionality) and whether we should be able to select the same condition multiple times per field. I opted for allowing only one condition type but it sounds like the initial use case would require multiple conditions of the same type which wouldn't be difficult to do.

Status: Needs review » Needs work

The last submitted patch, 2: ffc-allow-multiple-conditions-2215567-2.patch, failed testing.

dshields’s picture

This seems to work - thanks, mducharme!

elvizzi’s picture

Patch #3 says, failed testing? Any more work being done on this or releasing a new dev release?

Status: Needs work » Needs review
rootwork’s picture

Status: Needs review » Needs work

The patch in #2 still applies (although weirdly, only using patch -p1 < [patchfile] rather than git apply < [patchfile]) and works in 7.x beta2 as well as 7.x dev.

Tests were added at some point and indeed, this patch does not update those tests and therefore fails several of them.

But this module hasn't had a commit since 2013. So I think it's safe to say this might be the best you're going to get, unless you or someone else wants to update those tests.

Marking this as needs work as technically those tests should be fixed, but for most people the patch in #2 will be the solution.

rootwork’s picture

Oh, but I should point out that the patch in #2 only allows for multiple different type conditions. In other words, if you have one condition that is "Hide when target field does not contain a string," you can't have a second condition of that type, even targeting another field. But with this patch you can add another condition of, say, "Hide if target field is empty."

So perhaps another reason to explore more work on this patch.