This module seems to be full of validation issues.

Found one more, when using the field as required and being controlled by another field, it keeps throwing a CCK core validation error - "Field is required", even if field is filled properly.

CommentFileSizeAuthor
#4 emailconditionalfields-1047728-4.patch643 bytesroborn

Comments

andyhu’s picture

I have also experinced this issue. Subscribing

easp’s picture

Same issue.

DanielWashbrook’s picture

Found a quick solution. In conditional_fields.module in the function conditional_fields_check_empty($field) (on or about line 989 for version 2beta) it checks the value of the fields but will always fail the email check because of the way the CCK Email module stores the form data. So turn the function into this:

function conditional_fields_check_empty($field) {
  // Normal fields
  if (isset($field[0]['value'])) {
    $value = $field[0]['value'];
  }
  else if (isset($field[0]['email'])) {
    $value = $field[0]['email'];
  }
  // Node reference
  elseif (isset($field[0]['nid'])) {
    $value = $field[0]['nid'];
  }

  if (!count($value) || (is_string($value) && drupal_strlen(trim($value)) == 0)) {
    return TRUE;
  }

  return FALSE;
}

Sorry I don't have time to whip up a patch.

Daniel

roborn’s picture

Project: Email Field » Conditional Fields
Version: 6.x-1.2 » 6.x-2.0-beta2
Component: Code » Compatibility w/ other modules
Status: Active » Needs review
StatusFileSize
new643 bytes

Patch for #3

Also, this is a Conditional Fields issue.

AtomicTangerine’s picture

Project: Conditional Fields » Email Field
Version: 6.x-2.0-beta2 » 6.x-1.2
Component: Compatibility w/ other modules » Code
Category: bug » support
Status: Needs review » Active

It's not so much Conditional Fields actually, if you read its project page, you'll see:
"Supported dependee fields are for now only core fields (D7) or CCK widgets (D6). That is: select, checkbox, radio and text. Other field types might work but are not supported. Follow this issue for ongoing development."

The thread the "this issue" links to is: #648934 so that's the thing to follow if interested, otherwise, either the email field module will have to support to Conditional Fields, or contributions need to be made to the plugin described in that thread. Probably a bad idea to directly modify Conditional Fields module code, as won't it just get overridden when updates are pushed?

Also, peterpoe seems to keep his issues very tight and neat, so to help point you in a possible direction, this: #453204 is where you find information about how required fields, fieldgroups, etc support came about, and any issues with validation with supported fields, would go.

(also I changed the issue details back as they were before roborn's reassignment)

jackbravo’s picture

subscribe

ashhishhh’s picture

Thanks Daniel :)

WorldFallz’s picture

Since there is no longer a conditional_fields_check_empty function in conditional_fields 2.x-dev, has anyone figured out how to solve it recently?