On activating the current dev version I receive a varying list of the following errors.

# Notice: Undefined variable: currPage in _webform_conditional_possible_trigger_components() (line 470 of /home/mywebsiteexample.com/sites/all/modules/webform_conditional/webform_conditional.module).
# Notice: Undefined index: 138 in _webform_condtional_get_usable_child_elements() (line 516 of /home/mywebsiteexample.com/sites/all/modules/webform_conditional/webform_conditional.module).
# Notice: Undefined index: webform_conditional_field_value in webform_conditional_form_webform_component_edit_form_alter() (line 33 of /home/mywebsiteexample.com/sites/all/modules/webform_conditional/webform_conditional.module).

I'll see if it still allows me to save a conditional rule.. the options are displaying on the field edit page but I haven't tried saving yet.

Comments

rumblewand’s picture

Holy wow the list of errors on viewing the actual form is long mainly involving the cid. Did not hide the field either. I will try a few things and see what I can find.

rumblewand’s picture

OK. I uninstalled and reinstalled the dev 7 module and did not receive the first batch of errors. However I do still receive errors on all my fields in the existing webform along the lines of

# Notice: Undefined index: webform_conditional_cid in webform_conditional_form_alter() (line 106 of /home/tarrantcountykids/tarrantcountykids.org/sites/all/modules/webform_conditional/webform_conditional.module).
# Notice: Undefined index: #type in _webform_conditional_get_field() (line 590 of /home/tarrantcountykids/tarrantcountykids.org/sites/all/modules/webform_conditional/webform_conditional.module).
rumblewand’s picture

Spoke too soon. The first set of errors still appears when editing a particular field. I'll hold off on anymore investigating for now, my eyes are bleeding.

tedbow’s picture

I am thinking that you may have your php error_reporting set wrong. I think generally you should not be showing the error type "Notice".

Can somebody confirm this?

rumblewand’s picture

Hi Ted! I don't mind disabling the output of the Notice errors but I'm inclined to believe they are somehow responsible for me not being able to hide any fields conditionally however I can't say for sure since the dev release is new.

rumblewand’s picture

SOLVED - the following change to my template.php file disrupts the webform conditional somehow and you may need to be aware. I used it to ensure that field descriptions would appear above the input for user instructions.

/**
* Replacement for theme_webform_element() to enable descriptions to come BEFORE the field to be filled out.
*/
function danland_webform_element($variables) {
  $element = $variables['element'];
  $value = $variables['element']['#children'];

  $wrapper_classes = array(
    'form-item',
  );
  $output = '<div class="' . implode(' ', $wrapper_classes) . '" id="' . $element['#id'] . '-wrapper">' . "\n";
  $required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';

  if (!empty($element['#title'])) {
    $title = $element['#title'];
    $output .= ' <label for="' . $element['#id'] . '">' . t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
  }

  if (!empty($element['#description'])) {
    $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
  }
 
  $output .= '<div id="' . $element['#id'] . '">' . $value . '</div>' . "\n";

  $output .= "</div>\n";

  return $output;
}

Once I removed this and cleaned my caches the webform conditionals module works as expected! I also noticed a patch in the drupal 7 thread that fixes various errors!

rumblewand’s picture

I'll open a different thread regarding getting the module to work with the above enhancement to webform.

tedbow’s picture

Status: Active » Closed (works as designed)

@rumblewand, Ok I am closing this issue.

teranex’s picture

Status: Closed (works as designed) » Needs review
StatusFileSize
new858 bytes

In PHP 5.3 notices are enabled by default. This notice can be avoided by always defining the $currPage variable. The attached patch does this.

tedbow’s picture

Status: Needs review » Closed (fixed)

teranex
thanks, I have commited this to 6 & 7 dev branches