In previous dev versions of Conditional Fields, I was able to make a field unavailable using the "Field Permissions" module and ensuring that "Hide the dependent if the dependee is not in the form" was checked.

In the current dev version, I get the following errors when I try to to add content to an affected content type when the dependee is unavailable to the role in question:

Notice: Undefined index: field_target_or_actual in conditional_fields_form_after_build() (line 436 of /var/www/dev/ppnyc/sites/all/modules/conditional_fields/conditional_fields.module).
Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called in /var/www/dev/ppnyc/sites/all/modules/conditional_fields/conditional_fields.module on line 437 and defined in drupal_array_get_nested_value() (line 6348 of /var/www/dev/ppnyc/includes/


Status:Active» Needs review
new3.63 KB

I have the same issue (with OG field access).
This patch fixes this. I've changed:

= $dependency['dependee'];
$dependee_info = $form['#conditional_fields'][$dependee];


= $dependency['dependee'];
// If the dependee is not part of the form (due to permissions),
// continue to the next conditional field.
if (!isset($form['#conditional_fields'][$dependee])) {
$dependee_info = $form['#conditional_fields'][$dependee];

The rest of the patch is just Drupal Code styling (removed unneeded spaces after some lines).

Status:Needs review» Fixed

This was fixed in commit 890c237.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status:Closed (fixed)» Active

Sorry but this doesn't seem to be completely fixed. I hid the main dependee (using Field Permissions) for all the users but anonymous so they can only select that option when they are signing up but no longer change it when they try to edit their profiles, because that auto assign the role.

The registration process go perfectly but when they go to edit their profile, where the main dependee is hidden, the dependents are all showed and if they are required the user won't be able to save their profile changes without filling them up. I tested making the dependee visible and then all the depedents are correctly hidden and toggled when editing but that way the users can change the main dependee but their role won't change, so I will be in troubles. Please help me.

Okay this sounds simple but it works.

Broken example:

[required dependent] is invisible when [dependee] has at least one of the values: option1, option2.

Working example:

[required dependent] is visible when [dependee] has none of the values: option1, option2.

This is a reversal of thinking but it works.