I am using editablefields in conjunction with Conditional Fields. I have a front end editable user status view that has a drop down select box with five options:

  1. 0|In
  2. 1|Gym
  3. 2|Lunch
  4. 3|Out
  5. 4|Other

I created a dependency that makes a custom status text field appear only when "4|Other" is selected--which is working as expected. On the other hand, I also set it up so that when "4|Other" is NOT selected the custom text field should be emptied. Here's the problem: it's not emptying the custom text field as expected.

This is important because if a user chooses 'Other' and puts in a custom status in the text field but returns later and changes their status to 'In', they wouldn't want their previous custom status to continue to show.

Am I doing something wrong?

Thanks in advance--


aaronbauman’s picture

I can't get this to work either, using Conditional Fields' logic as I understand it (which is not very much), regardless of any third-party modules.

This particular request, at least from my experience, is the number one most common use case for Conditional Fields.
A video tute, an exportable, or an example module that implements this specific use case would be so, so helpful.

aaronbauman’s picture

Issue summary: View changes

Sorry, spelling correction.

Outi’s picture

Issue summary: View changes

I think I have the same problem. I have a boolean field "Field A", and when it has the value 0, the next field, "Field B", with two checkboxes is hidden. When it has the value 1, the field "Field B" is shown and required. Now, if the user wants to modify the fields and sets the value of the "Field A" to 0, the value of the "Field B" should be emptied from the database, but this doesn't happen.

I have tried different combinations of the options "unchecked", "has value", "filled with a value" and "emptied" (and can unfortunately not recall all of them), but I cannot make it work.

I am by the way using the patch from https://drupal.org/node/2180107, but I don't think it affects this.

Outi’s picture

Ok, I just noticed that in the "Edit context settings" section (in the "Edit dependency" page) it is mentioned that "The Javascript form state that is applied to the dependent field when the condition is met. Note: this has no effect on server-side logic and validation." So I will not manage to do this with the configuration.

andyg5000’s picture

Title: "Other" field, emptied when NOT selected - not working » Edit dependency validation with multi-valued dependency causes data loss
Component: Compatibility w/ other modules » Code
Assigned: aseabrook » Unassigned

The logic in conditional_fields_evaluate_dependency() can cause data loss whenever the dependency is multi-valued. This is because the submitted form values do not contain the array keys saved in the options array for the dependency so comparing them using array_values($dependency_values) == array_values($values) will return false and cause the validation routine to wipe the submitted value.


// Multi-valued options set in "value from widget".
$dependency_values = array(
 'one' => 'one',
 'two' => NULL,
 'three' => NULL,

// Submitted form values. 
$values = array(
  'one' => 'one',
andyg5000’s picture

I'm able to get around this by using "Only one of these values (XOR)", but this should still be considered a critical bug since it can cause data loss.

agerson’s picture

We are effected by this issue.

calebyoder’s picture

I am facing the same issue if I understand correctly. The field doesn't empty like it seems it's supposed to. So, even though the field may be invisible when the form is submitted, the value is still sent. Does anyone have any more input?

calebyoder’s picture

I actually got it working now, I think! At least for what I need. Not sure exactly what all made the difference. But, I am using both the "visible" action and the "disable" action and both of these depend on "value" and it is not sending the value on the hidden and disabled fields.