Sometimes when trying to add a reaction to one conditional I get this error in the AJAX request:

Notice: Undefined index: source_type in webform_conditional_element_add() (line 759 of …/includes/webform.conditionals.inc)

It seems to somehow depend on the a previous editing step so it’s rather hard to reproduce. I’ll add more information once I’ve narrowed it down a bit. Maybe this already rings some bells.

Comments

torotil created an issue. See original summary.

liam morland’s picture

Snehal Brahmbhatt’s picture

Status: Active » Needs review
StatusFileSize
new602 bytes

@Liam Morland, Please find this patch to resolve the above-mentioned patch, I received it in the AJAX when installing the module.

liam morland’s picture

Why is empty() changed to !empty()?

With this patch, $new[0] is not set if $parent_values[$rid]['source_type'] is not set, rather than getting $default_rule. Is that intentional?

Snehal Brahmbhatt’s picture

StatusFileSize
new601 bytes

@Liam Morland, Thanks for reviewing my patch, I updated it again. Kindly review it & let me know if any further change is required. Thanks!..

liam morland’s picture

Can you answer the second question in #4?

joelpittet’s picture

@Liam Morland, good question, it's probably not intentional. $new[0] is however set in the else block but not to the $default_rule.

I can't really follow the logic myself so not sure which is correct, maybe you know?

liam morland’s picture

I don't know what it is supposed to be like. For fixing undefined index errors, I hesitate to make any changes in how it works unless I am sure it is actually a bug.

liam morland’s picture

Does this solve it for you? This shouldn't have any effect on the functionality.

This may have been resolved in #2842513: Undefined index: operator in _webform_conditional_expand(). Have you reproduced the issue on 7.x-4.18?

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

I've seen it recently (Nov 6th in 7.x-4.18), that looks like it would fix the notice without changing how it works, thanks @Liam Morland.

  • Liam Morland committed 91d00f1 on 7.x-4.x
    Issue #2948996 by snehal.addweb, Liam Morland, joelpittet: Fix Undefined...
liam morland’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.