I am getting the following error message when saving a select box component and then returning to the webform overview page:

Notice: Undefined index: classes in webform_classes_webform_component_update() (line 75 of [..]/webform-classes/webform_classes.module).

Comments

Luke Harrison’s picture

StatusFileSize
new632 bytes

Patch attached.

carlhinton’s picture

Status: Active » Closed (fixed)

This has been fixed in the 7.x-1.0 stable version.

vlad.dancer’s picture

Status: Closed (fixed) » Active

This is not fixed in the 7.x-1.0 stable version. First of all, code from patch didn't commited to the project. Second how it could be fixed if comment #2 posted on July 25, 2012 at 10:41am but version 1.0 posted on 2012-Jun-28. Please update this issue!

bluemuse’s picture

I can confim I also just received the same error message upon installing. Note it's not a clean instal. I am using the conditionals version of webform, as well as webform validation.

vlad.dancer’s picture

Priority: Normal » Major

CarlHinton, please update situation!

carajito’s picture

Hi, I have the same issue

With webform 7.x-4.0-alpha6

skaught’s picture

this issue still exists.

sonicthoughts’s picture

same error in v1 but patch seems to resolve. pls commit.

aaronott’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

The original patch supplied doesn't solve the root issue or possibly caused a new issue.

In a fresh install I noticed that this issue is still a problem so it doesn't appear that the module has been patched. After applying the patch in #1, the error message does indeed go away however I noticed that my classes were now disappearing. Looking into the issue I found that the classes were being overwritten by '' (blank). Going back to the component and re-adding the class would fix the issue temporarily until I needed to move a field around.

Steps to reproduce:

1) Apply patch in #1
2) Add two components
3) assign a class to the component
4) re-order the components
5) edit a component to see that the class definition has now been blanked

Root Cause:
hook_webform_component_update is called when the component is updated (works) but is also called on each element when the ordering of the fields are altered (causes error).

When the full webform is 'Save'd the class parameters have a different name than when a component itself is saved.

Component Submit:

Array
(
    [type] => textfield
    [nid] => 2
    [cid] => 21
    [clone] => 
    [name] => Date of Birth
    [form_key] => date_of_birth
... removed ...
    [classes] => Array
        (
            [classes] => fourColumn
        )

    [op] => Save component
)

Webform Save:

Array
(
    [nid] => 2
    [cid] => 21
    [pid] => 1
    [form_key] => date_of_birth
    [name] => Date of Birth
    [type] => textfield
... removed ...
    [class] => 
    [page_num] => 1
)

Notice when the component is saved there is a $component['classes']['classes'] array assigned and when the webform is saved the same field is defined as $component['class'].

There are two ways to fix this error, either fix the discrepancy between the two submits, or check for the $component['op']. I haven't had much time to look through the rest of the module and fix the discrepancy so I've implemented the second option in the attached patch. I think it would be a good idea to fix the root cause (discrepancy) to reduce confusion going forward.

aaronott’s picture

Probably should check to see if $component['op'] exists to prevent other errors.

carlhinton’s picture

Please use the 7.x-2.0 stable version.

carlhinton’s picture

Status: Needs review » Closed (fixed)