Download & Extend

Orphaned fields don't show when triggered

Project:Conditional Fields
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I set it so that orphaned fields would be displayed when triggered. (i.e.: The controlling field, while not editable, has an appropriate triggering default value, or were previously set by someone with permissions to edit the field in question.)

However, even when the controlling field (field_ticket_state) held the appropriate value to show the controlled field (field_proofs_okay), said controlled field was not displayed.

In function: conditional_fields_node_editing_form

<?php
if (!$show_triggered || !in_array($form_state['values'][$field['control_field_name']][0]['value'], $field['trigger_values'])) {
?>

^--- $form_state['values'] is not set in my case.

So I worked around it by changing these lines to:

<?php
if (!$show_triggered || !in_array($form[$field['control_field_in_group']][$field['control_field_name']]['#value'][0]['value'], $field['trigger_values'])) { /*In Group, haven't tested this yet. */
?>

<?php
if (!$show_triggered || !in_array($form[$field['control_field_name']]['#value'][0]['value'], $field['trigger_values'])) {
/*Not in group, verified to work sometimes. Best way to do this? */
?>

Comments

#1

Version:6.x-1.0-beta2» 6.x-1.x-dev
Status:active» fixed

As usual, the bug you reported was hiding another bug :(
Fixed in dev: now orphaned fields in node editing form should display or hide properly.

Thanks

#2

Status:fixed» needs review

this works in node editing form but not yet on node view....

could you please check ?

thanks

#3

#2 Node view is working for me. Make sure that "Reset untriggered fields to default values" is unchecked, or untriggered controlled fields will never appear unless they have a default value different than none.

#4

Status:needs review» closed (fixed)

it seems to work fine now... thanks for the hint...

nobody click here