Im trying to setup conditional fields, we use the location module to grab user address on registration. We wanted a to have the option of a second contact address, controlled by conditional fields to display/require it if the user has selected the second contact option.

the dependance rule is

field_address_cont is visible when field_a_a_c has value "1".
and
field_address_cont is required when field_a_a_c has value "1".

Value 1 = yes on my Boolean boxes. When i select yes nothing happens the address field is already displayed

This rule/module works fine for standard fields earlier in the registration form. I'm also seeing this same behavior with a "link" field where the rule is if the user enters a website they must enter a email address for that site. Once again the field is not hidden nor is it required when the dependee is checked

Comments

jkirkby91’s picture

at the same time while submitting im seeing these errors

Notice: Undefined index: und in conditional_fields_evaluate_dependencies() (line 1020 of sites/all/modules/conditional_fields/conditional_fields.module).
Notice: Undefined index: und in conditional_fields_evaluate_dependencies() (line 1020 of sites/all/modules/conditional_fields/conditional_fields.module).
ShaneOnABike’s picture

Issue summary: View changes

I came across a blog posted that indicated that it was an issue related to the entity and bundle not being set. http://zewaren.net/site/?q=node/140

I can confirm that the fix in creating a custom module really worked for me ;)

function conditional_fields_extra_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
  if ($entity_type == 'profile2' && $entity->type == 'producer_profile') {

    // Add reference for the location cck
    $form['field_producer_location']['#entity_type'] = $entity_type;
    $form['field_producer_location']['#bundle'] = $entity->type;

    if (isset($form['field_producer_location'][LANGUAGE_NONE])) {
      $form['field_producer_location'][LANGUAGE_NONE]['#entity_type'] = $entity_type;
      $form['field_producer_location'][LANGUAGE_NONE]['#bundle'] = $entity->type;
    }
}