Orphaned fields don't show when triggered

ksun - October 22, 2009 - 01:14
Project:Conditional Fields
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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? */
?>

#1

peterpoe - November 27, 2009 - 23:21
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

bendev - November 30, 2009 - 20:53
Status:fixed» needs review

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

could you please check ?

thanks

#3

peterpoe - December 2, 2009 - 13:48

#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

bendev - December 2, 2009 - 21:17
Status:needs review» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.