Commit 8c4bf0f2 authored by Dan Chadwick's avatar Dan Chadwick
Browse files

Issue #2327775 by DanChadwick: Fixed new default conditional contains remnants...

Issue #2327775 by DanChadwick: Fixed new default conditional contains remnants of last define conditional's rules.
parent a3e70fd2
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -123,18 +123,20 @@ function webform_conditionals_form_add($form, &$form_state) {
    $weight = max($weight, $conditional['weight']);
  }

  $conditional['weight'] = $weight + 1;
  $conditional['rules'][0] = array(
  // Add the conditional to form state and rebuild the form.
  $form_state['values']['conditionals'][] = array(
    'rules' => array(
      array(
        'source' => NULL,
        'operator' => NULL,
        'value' => NULL,
      ),
    ),
    'andor' => 'and',
    'action' => 'hide',
    'target' => NULL,
    'weight' => $weight + 1,
  );
  $conditional['action'] = 'hide';
  $conditional['target'] = NULL;
  $conditional['andor'] = 'and';

  // Add the conditional to form state and rebuild the form.
  $form_state['values']['conditionals'][] = $conditional;
  $form_state['rebuild'] = TRUE;
}