Hi there, just downloaded the latest version from 28/04 because I encountered a bug

Looks like the bug was fixed but now some odd thing happens...

I have 2 fields where I want the scenario to be at least one is required but user can fill either one or both....
So I make 2 dependencies.

Field A is required if field B is empty
Field B is required if field A is empty

I have tried with both required ticked and unticked in the fields themselves, and these rules negates the required effect...
In the form the asterix isn't there at all, and no form state change, and I can submit the form with empty values in both...

Bug or am I doing it wrong?, I had it almost working before downloading the latest

Comments

peterpoe’s picture

Title: Required is negated when dependency is made » Fields that depend on each other are not evaluated correctly
Status: Active » Fixed

Fixed in dev, thanks for reporting.

Note though that to achieve the desired result you will have to use the "Value" condition, not the "Empty" condition, since the "Value" condition is currently the only that allows evaluation of dependencies on server-side. The other conditions are just Javascript effects! This will be fixed, but in the meantime use "Value" and leave the widget empty in the "Insert value from widget" box.

Also note that you have to check the "Required" checkbox for each field in the field settings.

There is another error that makes two asterisks ** appear on dependent required fields, but I suspect this is a bug in core, will investigate...

acoustika’s picture

Yep, thx

This is fixed now, except the double asterix..... Working as I want now using the value dependency

acoustika’s picture

Status: Fixed » Needs review

Actually I think another thing sneaked in doing it this way....

Now none of the 2 fields is showing up on the node event though they both have a value in the form, figured out to remove the tick from "Hide the field if the dependency is not triggered" in view context, but now when I fill in a value in one of the fields the other one is also field with that value, that is not as intended.... It's supposed to stay empty

Anonymous’s picture

Status: Needs review » Needs work

I'm actually still getting the same bug (I think). I just have a checkbox field and a text field (set to required in field settings). I've setup conditional_fields s.t. when checkbox value=0 the text field is optional, but the opposite is happening. If I submit the form with the checkbox unchecked, the form complains about the required field being empty. But if I submit the form with the checkbox checked (and an empty text field), it doesn't complain.

If it's relevant, I'm using the Field Group module and these fields are in the same group.

Also I have ticked "Hide the dependent if the dependency is not triggered" and this is not working (the dependent text field is always visible).

  • peterpoe committed 135470a on 8.x-1.x
    Fixed #1553266: Fields that depend on each other are not evaluated...